I have a Carbon application and am experiencing a strange error with
fopen.
First time I open the file with fopen, it succeeds. I then close the
file with fclose.
But when I try to open the same file the second time (using the same
code), it fails with errno == 2. Also, if I try to open a different
file, it fails. Only the first fopen succeeds.
Any ideas? Here's the relevant code fragment:
char filename[256];
sprintf(filename, "./level%d.txt", m_current_level + 1);
FILE* fp = fopen(filename, "r");
if(fp) {
...
fclose(fp);
}
I've debugged and filename is correct on the second time, as well.
Using Xcode 3.1 (beta), linking with frameworks libglfw.a,
Carbon.framework, OpenGL.framework, AGL.framework.


|