1 Reply Latest reply: Feb 20, 2013 9:02 AM by Frank Caggiano
Dhiraj Bhor Level 1 Level 1 (0 points)

Hi all

I am opening a file that does not exists.

But after i got message File does not exists,

gdb does not stop.What should i do?

Suggestions are welcome.



my program:


int main (int argc, const char * argv[])


          FILE* fd;

          fd = fopen("abc123.txt", "r");


          if(NULL == fd)


  printf("File does not exists\n");

  return -1;


printf("File Opened\n");

return 0;


And here is the output:


Not a file


Debugger stopped.

Program exited with status value:255.The program being debugged is not being run.

The program being debugged is not being run.


Mac mini, Mac OS X (10.6.4)
  • 1. Re: C file handling on xcode 3.2.3
    Frank Caggiano Level 7 Level 7 (23,830 points)

    The program didn't encounter a debugable  error.  The fopen failed to open the file, the file pointer was checked for a Null value (which is what is returned by an fopen failing in some way and then the program terminated with a -1 (255 to the terminal)


    If you want to run the debugger when this happens you will need to set a breakpoint after the fopen and before the return.