Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > invalid conversion from int to file

Reply
Thread Tools

invalid conversion from int to file

 
 
fazulu deen
Guest
Posts: n/a
 
      05-24-2007
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

 
Reply With Quote
 
 
 
 
Keith Halligan
Guest
Posts: n/a
 
      05-24-2007
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.


 
Reply With Quote
 
 
 
 
fazulu deen
Guest
Posts: n/a
 
      05-24-2007

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

 
Reply With Quote
 
Keith Halligan
Guest
Posts: n/a
 
      05-24-2007
On May 24, 2:33 pm, fazulu deen <(E-Mail Removed)> wrote:
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
invalid conversion from void* to int** =?ISO-8859-1?Q?Martin_J=F8rgensen?= C Programming 5 05-16-2006 09:05 PM
invalid conversion from `int*' to `socklen_t*' Abhijit Bhadra C++ 8 12-01-2004 10:44 AM
Compiling pymat: invalid conversion from `const maybelong*' to`int*' Roy Yves Python 0 06-10-2004 05:01 PM
int main(int argc, char *argv[] ) vs int main(int argc, char **argv ) Hal Styli C Programming 14 01-20-2004 10:00 PM
dirty stuff: f(int,int) cast to f(struct{int,int}) Schnoffos C Programming 2 06-27-2003 03:13 AM



Advertisments