-
-
Save Bhavya8181/6787a77acb4025fcbcb9f41f1a71d3e7 to your computer and use it in GitHub Desktop.
how to open, read, and close a file on the server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Modes Description | |
r -> Open a file for read only. File pointer starts at the beginning of the file | |
w -> Open a file for write only. Erases the contents of the file or creates a new file if it doesn't exist. File pointer starts at the beginning of the file | |
a -> Open a file for write only. The existing data in file is preserved. File pointer starts at the end of the file. Creates a new file if the file doesn't exist | |
x -> Creates a new file for write only. Returns FALSE and an error if file already exists | |
r+ -> Open a file for read/write. File pointer starts at the beginning of the file | |
w+ -> Open a file for read/write. Erases the contents of the file or creates a new file if it doesn't exist. File pointer starts at the beginning of the file | |
a+ -> Open a file for read/write. The existing data in file is preserved. File pointer starts at the end of the file. Creates a new file if the file doesn't exist | |
x+ -> Creates a new file for read/write. Returns FALSE and an error if file already exists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment