hi,
I want open a file and read something out but if I close the file then the program crashed and I dont know why. maybe anybody can have a look on the source ?
Whenever a program crashes while trying to allocate or free memory, it suggests memory corruption. Check that you're not overflowing any buffers, or freeing the same pointer twice, and you're not forgetting to initialize anything before trying to use it. That last one actually gave me a very strong headache, once.
hi,
"strncpy(tmp, m_FileName, strlen(m_FileName));"
here I am sure that the buffer is big enough. yes, in the final solution I have to allocate the memory dynamically ;)
to "fgets (buffer/*m_Overlay_mp3Tag.unstructered , m_cID3v1_Size , pFile);"
first I have tried "fgets (m_Overlay_mp3Tag.unstructered , m_cID3v1_Size , pFile);" whereby the size of "m_Overlay_mp3Tag.unstructered" is 128 bytes (m_cID3v1_Size=128, too). I think it is correct, or ?
the "m_Overlay_mp3Tag" is initialized at creation with '0', I have used memset.
The problem is the fclose, at this point the program crashed and I dont know why.
yes you must have right, because I have copied the content of the procedure in the main part and it works. I have to find the corruption at any other point.