Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, March 18, 2015

What is file modes ?

  • Mode specifies the purpose of opening the file.
  • Mainly mode divided into 3 types Read (r), Write (w), and Append (a).
  • Read mode is used to opening the file for reading only.
  • If the file is not exists in read mode, an error occurs.
  • Write mode is used to opening the file for writing only.
  • If the file is exists in write mode, all contents are deleted.
  • Append mode is used to open the file for adding or appending data into the file.
  • If the file is not exists in append mode, file is created.
File mode
Operation
r
Open the file reading only
w
Open the file writing only
a
Open the file for appending data
r+
Both reading and writing
w+
both reading and writing
a+
Both reading and writing


Ex:
FILE *fp1, *fp2, *fp3;
fp1 = fopen (“ file1 ”, ” r ”);
fp2 = fopen (“ file2 “, “ w “);
fp3 = fopen (“ file3 “, “ a “);

No comments:

Post a Comment