Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer Help > Strange fopen e...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 3734 of 3882
Post > Topic >>

Strange fopen error

by mayoneez <mikko.oksalahti@[EMAIL PROTECTED] > May 6, 2008 at 11:24 PM

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.
 




 4 Posts in Topic:
Strange fopen error
mayoneez <mikko.oksala  2008-05-06 23:24:28 
Re: Strange fopen error
mayoneez <mikko.oksala  2008-05-06 23:49:03 
Re: Strange fopen error
Gregory Weston <uce@[E  2008-05-07 07:37:13 
Re: Strange fopen error
mayoneez <mikko.oksala  2008-05-08 03:33:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 9:54:19 CST 2008.