Hi,

I'm getting a segmentation fault when I call fopen to open a file that doesn't 
exist.   Here's the code snippet:

 if ((file = fopen("mydata", "r")) == NULL)
 {
     // file does not exist - create
     if ((file = fopen("mydata", "w+")) == NULL)
     {
         printf("Unable to create configuration file\n");
     }
     else
     {
        // initialize file
     }
 }

When the file "mydata" exists, it works fine; however, when it doesn't, my 
application crashes; I traced it down to the first fopen call, it never returns 
before crashing.  Anyone experiencing this?  Is fopen defined in glibc?  I have 
spent the last few days trying to track it down but no luck.  Thanks in advance.

Regards,
Andy
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to