• File opening mode specifies the purpose for which programmer wants to open the file.
• C provides three basic purposes; read, write and append.
• And the basic modes area “r” for reading, “w” for writing, and “a” for appending data.
• All basic and mixed modes are tabulated below:
Mode Purpose
r Read in text mode
w Write in text mode
a Append in text mode
r+ Read + write in text mode
w+ Write + read in text mode
a+ Append + read in text mode
rb Reade in binary mode
wb Write in binary mode
ab Append in binary mode
rb+ Read + write in binary mode
wb+ Write + read in binary mode
ab+ Append + read in binary mode
• The file opening mode to be used depends upon requirement and “whether the file already exists?”
• Some important situations are given below.
Mode File already exist File does not exist
r Read -
w Overwrite Create
a Append Create
• C provides three basic purposes; read, write and append.
• And the basic modes area “r” for reading, “w” for writing, and “a” for appending data.
• All basic and mixed modes are tabulated below:
Mode Purpose
r Read in text mode
w Write in text mode
a Append in text mode
r+ Read + write in text mode
w+ Write + read in text mode
a+ Append + read in text mode
rb Reade in binary mode
wb Write in binary mode
ab Append in binary mode
rb+ Read + write in binary mode
wb+ Write + read in binary mode
ab+ Append + read in binary mode
• The file opening mode to be used depends upon requirement and “whether the file already exists?”
• Some important situations are given below.
Mode File already exist File does not exist
r Read -
w Overwrite Create
a Append Create
No comments:
Post a Comment