Instead of printf("Error");
, you should try perror("Error")
which may print the actual reason of failure (like Permission Problem, Invalid Argument, etc).
More Related Contents:
- C fopen vs open
- What happens if I don’t call fclose() in a C program?
- ftell at a position past 2GB
- Tried and true simple file copying code in C?
- ‘ ‘, ‘\n’ , scanf() and output screen
- How to work with a variable number of variables in C?
- Read/write files within a Linux kernel module
- C read file line by line
- What are the rules of automatic stdout buffer flushing in C?
- When should I use mmap for file access?
- Code for printf function in C [duplicate]
- Atomicity of `write(2)` to a local filesystem
- Reading a line using scanf() not good?
- What will happen if ‘&’ is not put in a ‘scanf’ statement?
- C write in the middle of a binary file without overwriting any existing content
- Why does ‘fopen’ return a NULL pointer?
- File Operations in Android NDK
- Why does open() create my file with the wrong permissions?
- Delete a Line from a file in C Language
- What is the rationale for fread/fwrite taking size and count as arguments?
- How can you flush a write using a file descriptor?
- C equivalent to fstream’s peek
- Understanding concurrent file writes from multiple processes
- Why does forking my process cause the file to be read infinitely
- Is there a standard way to do an fopen with a Unicode string file path?
- whitespace in the format string (scanf)
- Why does this code print two times? [duplicate]
- Reading a file character by character in C
- ungetc: number of bytes of pushback
- Is close/fclose on stdin guaranteed to be correct?