Govt. Exams
Entrance Exams
The 'b' flag specifies binary mode, which prevents any translation of line endings or special characters.
The 'r' mode opens a file for reading only. The file must exist, otherwise fopen() returns NULL.
Opening a file in 'w' mode truncates the file to zero length if it exists, discarding all previous content.
"w" mode opens a file for writing. If the file exists, it truncates the file to zero length. If it doesn't exist, a new file is created.
fclose() is the standard function to close an opened file stream. It returns 0 on success and EOF on error.
'rb' mode opens a file for reading in binary format. Binary mode reads the exact bytes without any text conversion.
fopen() is the standard C library function used to open a file. It takes two arguments: filename and mode.