By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,368 Members | 1,435 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,368 IT Pros & Developers. It's quick & easy.

invalid conversion from int to file

P: n/a
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

May 24 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.
May 24 '07 #2

P: n/a

Keith Halligan wrote:
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

May 24 '07 #3

P: n/a
On May 24, 2:33 pm, fazulu deen <fazulu.v...@gmail.comwrote:
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.
May 24 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.