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.
More Related Contents:
- How to write a binary integer to binary file | c [closed]
- What is the difference between NULL, ‘\0’ and 0?
- Is NULL always zero in C?
- C fopen vs open
- Does free(ptr) where ptr is NULL corrupt memory?
- When was the NULL macro not 0?
- Can a conforming C implementation #define NULL to be something wacky
- What happens if I don’t call fclose() in a C program?
- What is the result of NULL + int?
- Is NULL always false?
- What happens in OS when we dereference a NULL pointer in C?
- how to get hexdump of a structure data
- Difference between r+ and w+ in fopen()
- Read input.txt file and also output.bmp file from terminal (C-programming)
- Writing and reading (fwrite – fread) structures with pointers
- Unable to open a file with fopen()
- Is NULL in C required/defined to be zero?
- Is there a standard way to do an fopen with a Unicode string file path?
- Is there a way to use fopen_s() with GCC or at least create a #define about it?
- Redefining NULL
- 2GB limit on file size when using fwrite in C?
- What are the flags and macros in a Makefile? [closed]
- How to share memory between processes created by fork()?
- Build .so file from .c file using gcc command line
- Are there any downsides to passing structs by value in C, rather than passing a pointer?
- When can I omit curly braces in C?
- what’s the difference between the printf and vprintf function families, and when should I use one over the other?
- dynamic allocating array of arrays in C
- Pointer arithmetic when void has unknown size [closed]
- Can you bind() and connect() both ends of a UDP connection