invalid conversion from int to file

F

fazulu deen

Hi all,

For the following code :

file_ptr = fopen("pass_fail.txt", "a"); // error line 393

fdisplay(file_ptr, "Test Passed");

fclose(file_ptr);

resa = resa + 1;

}

else

{


printf("\nTEST FAILED\n\n\n");

file_ptr = fopen("pass_fail.txt", "a"); //error line 402

fdisplay(file_ptr, "Test Failed");

fclose(file_ptr);

}

}

else

{

if( vube_n.read() == 1 )

{


printf("\nTEST PASSED\n\n\n");

file_ptr = fopen("pass_fail.txt", "a");

fdisplay(file_ptr, "Test Passed");

fclose(file_ptr);

resa = resa + 1;

}

else

{



printf("\nTEST FAILED\n\n\n");

file_ptr = fopen("pass_fail.txt", "a");

fdisplay(file_ptr, "Test Failed");

fclose(file_ptr);

}

}

}

I am getting the error as:
testbench.h: In member function `void
testbench::always_process_238()':
# testbench.h:393: invalid conversion from `FILE*' to `int'
# testbench.h:394: `fdisplay' undeclared (first use this function)
# testbench.h:394: (Each undeclared identifier is reported only once
for each
# function it appears in.)
# testbench.h:395: invalid conversion from `int' to `FILE*'
# testbench.h:402: invalid conversion from `FILE*' to `int'
# testbench.h:404: invalid conversion from `int' to `FILE*'
# testbench.h:414: invalid conversion from `FILE*' to `int'
# testbench.h:416: invalid conversion from `int' to `FILE*'
# testbench.h:423: invalid conversion from `FILE*' to `int'
# testbench.h:425: invalid conversion from `int' to `FILE*'

How to resolve the above error??where is the mistake??

regards,
fazal

regards,
fazal
 
K

Keith Halligan

What have you got file_ptr declared as? It should be

FILE *file_ptr;

I'm guessing due to all the type conversion errors you're getting that
you have it declared as an int.
 
F

fazulu deen

Keith said:
What have you got file_ptr declared as? It should be

FILE *file_ptr;

I'm guessing due to all the type conversion errors you're getting that
you have it declared as an int.


hai,

Thanks...its really worked ....but the following:


fdisplay(file_ptr, "Test Passed");

giving error as..

`fdisplay' undeclared (first use this function)
Each undeclared identifier is reported only once for each function it
appears in.)

pls help me to solve..

regards,
fazal
 
K

Keith Halligan

Thanks...its really worked ....but the following:

fdisplay(file_ptr, "Test Passed");

giving error as..

`fdisplay' undeclared (first use this function)
Each undeclared identifier is reported only once for each function it
appears in.)

I haven't a clue what fdisplay does, it's not part of either the C or C
++ standard library as far as I know.

The reason it can't find the function is because you're making a call
to it, but the compiler can't find it. So if you know what libraries
and headers it's contained in then give that information to the
compiler and it will stop giving you the warning.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top