- UNIT-I (Array)
Definition
Macro substitution directives
File inclusion directives
Conditional compilation
Bitwise Operators
Shift operators
Masks
Bitfield
Macro substitution directives
File inclusion directives
Conditional compilation
Bitwise Operators
Shift operators
Masks
Bitfield
Opening modes of files
Various File Opening Modes:
The file is opened using
Mode “r”: It is a read only mode, which means if the file is opened in r mode, it won’t allow you to write and modify content of it. When
fopen()
function, while opening you can use any of the following mode as per the requirement.Mode “r”: It is a read only mode, which means if the file is opened in r mode, it won’t allow you to write and modify content of it. When
fopen()
opens a file successfully then it returns the address of first character of the file, otherwise it returns NULL.
Mode “w”: It is a write only mode. The
fopen()
function creates a new file when the specified file doesn’t exist and if it fails to open file then it returns NULL.
Mode “a”: Using this mode Content can be appended at the end of an existing file. Like Mode “w”,
File Pointer points to: last character of the file.
fopen()
creates a new file if it file doesn’t exist. On unsuccessful open it returns NULL.File Pointer points to: last character of the file.
Mode “r+”: This mode is same as mode “r”; however you can perform various operations on the file opened in this mode. You are allowed to read, write and modify the content of file opened in “r+” mode.
File Pointer points to: First character of the file.
Mode “w+”: Same as mode “w” apart from operations, which can be performed; the file can be read, write and modified in this mode.File Pointer points to: First character of the file.
Mode “a+”: Same as mode “a”; you can read and append the data in the file, however content modification is not allowed in this mode.
कोई टिप्पणी नहीं:
एक टिप्पणी भेजें