×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    24

    problem to close application after using fopen

    when i execute the following code

    FILE *fIn = fopen("C:\\_input.wav", "r");

    and then close the application i get this "program closed: .." screen with call signs. also when i close the file with fclose(fIn);

    has anyone an idea whats wrong here?

    thanks,
    oliver

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    do this first:

    http://www.newlc.com/article.php3?id_article=150

    it gives you better error description, so maybe then it would be possible to know what goes wrong.

    yucca

  3. #3
    Registered User
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    24
    thank you, very useful hint.

    the panic code i get is "ALLOC: 100597ac0" - seems like a memory leak. i then tried to delete the pointer or set it NULL.. dunno.. anyway it didnt help so i must ask again whats wrong?

  4. #4
    Registered User
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    24
    in case anyone has the same problem some time.. calling CloseSTDLIB(); will solve it :)
    if it isnt found #include <libc\sys\reent.h>

  5. #5
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    130
    thx dreamix...
    very usefull. ^o^

    btw where should i put CloseSTDLIB(); ?
    at the end of the function? or at every return of the function?

    like example below

    void CTest::test()
    {
    FILE *file;

    if ((file=wfopen((wchar_t*)myname.Ptr(),L"rb+"))==NULL)
    {
    //<<a>>
    return;
    }

    if(condition)
    {
    //<<b>>
    return;
    }

    fclose(file);
    CloseSTDLIB(); //<<c>>
    return;
    }

    in my opinion, i guess i should put it in <<b>> and <<c>>.
    is it correct?

    TIA
    Rx-lee

  6. #6
    Nokia Developer Expert
    Join Date
    Apr 2003
    Location
    Finland
    Posts
    425
    uups, nothing....

  7. #7
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    130
    nevermind,
    just fixed it.

    thx anyway.
    Rx-lee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×