C examples for File:File Operation
File Modes for fopen()
Mode | Description |
---|---|
"w" | Open a text file and truncate to zero length or create a text file for write operations. |
"uw" | Open a text file with default permissions and truncate to zero length or create a text file for write operations. |
"wx" | Create a text file for write operations. |
"uwx" | Create a text file with default permissions for write operations. |
"a" | Open a text file for append operations, adding to the end of the file. |
"ua" | Open a text file with default permissions for append operations, adding to the end of the file. |
"r" | Open a text file for read operations. |
"wb" | Open a binary file and truncate to zero length or create a binary file for write operations. |
"uwb" | Open a binary file with default permissions and truncate to zero length or create a binary file for write operations. |
"wbx" | Create a binary file for write operations. |
"ab" | Open a binary file for append operations. |
"rb" | Open a binary file for read operations. |
"w+" | Open or create a text file for update operations. An existing file will be truncated to zero length. |
"a+" | Open or create a text file for update operations, adding to the end of the file. |
"r+" | Open a text file for update operations (read and write anywhere). |
"w+x" | Create a text file for updating. |
"uw+x" | Create a text file with default permissions for updating. |
"w+b" or "wb+" | Open or create a binary file for update operations. An existing file will be truncated to zero length. |
"w+bx" or "wb+x" | Create a binary file for update operations. |
"a+b" or "ab+" | Open a binary file for update operations, adding to the end of the file. |
"r+b" or "rb+" | Open a binary file for update operations (read and write anywhere). |