invalid conversion from int to file

Discussion in 'C++' started by fazulu deen, May 24, 2007.

  1. fazulu deen

    fazulu deen Guest

    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
    fazulu deen, May 24, 2007
    #1
    1. Advertising

  2. 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.
    Keith Halligan, May 24, 2007
    #2
    1. Advertising

  3. fazulu deen

    fazulu deen Guest

    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
    fazulu deen, May 24, 2007
    #3
  4. On May 24, 2:33 pm, fazulu deen <> 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.
    Keith Halligan, May 24, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abhijit Bhadra
    Replies:
    8
    Views:
    8,884
    Abhijit Bhadra
    Dec 1, 2004
  2. Schnoffos
    Replies:
    2
    Views:
    1,213
    Martien Verbruggen
    Jun 27, 2003
  3. Hal Styli
    Replies:
    14
    Views:
    1,634
    Old Wolf
    Jan 20, 2004
  4. Roy Yves
    Replies:
    0
    Views:
    630
    Roy Yves
    Jun 10, 2004
  5. =?ISO-8859-1?Q?Martin_J=F8rgensen?=

    invalid conversion from void* to int**

    =?ISO-8859-1?Q?Martin_J=F8rgensen?=, May 14, 2006, in forum: C Programming
    Replies:
    5
    Views:
    2,474
    =?ISO-8859-1?Q?Martin_J=F8rgensen?=
    May 16, 2006
Loading...

Share This Page