F-Input and Output Flashcards
What function is used to open a file?
fopen()
r
Opens an existing file for reading purpose
w
Opens a text for writing
a
Opens a text file for writing in appending mode
r+
Opens a text file for both reading and writing only
w+
Opens a text file for both reading and writing; it first truncates the file to zero length if it exists, otherwise creates a file if it does not exist
a+
Opens a text file for both reading and writing; The reading will start from the beginning but writing will be appended.
What function is used to close a file?
fclose()
fputc()
writes a character value
fputs()
Writes a string
fprintf()
Writes a formatted string
fgetc()
Reads a character
fgets()
Reads a string
fscanf()
Reads a formatted string