Why does ‘fopen’ return a NULL pointer?

The proper thing to do is check errno when fopen returns NULL.

I’m going to guess that your problem is that you’re trying to write to a filesystem that doesn’t allow \n in filenames, but it could be a permissions issue as well.

Leave a Comment