Saturday, April 18, 2009

File Modes

The operating system on the server needs to know what you want to do with a file that
you are opening. It needs to know if the file can be opened by another script while you
have it open, and to work out if you (the owner of the script) have permission to use it
in that way. Essentially, file modes give the operating system a mechanism to determine
how to handle access requests from other people or scripts and a method to check that
you have access and permission to this particular file.
There are three choices you need to make when opening a file:
1. You might want to open a file for reading only, for writing only, or for both reading
and writing.
2. If writing to a file, you might want to overwrite any existing contents of a file or
to append new data to the end of the file.
3. If you are trying to write to a file on a system that differentiates between binary
and text files, you might want to specify this.

No comments:

Post a Comment