From the course: C Standard Library

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

File access

File access - C Tutorial

From the course: C Standard Library

Start my 1-month free trial

File access

which means extending a file by writing at the end of it. The optional plus sign at the end means an extended version of these access modes adding read and write access to the file. This function returns the address of a file variable so the way you're supposed to use it is by assigning its return value to a file pointer. On failure it returns NULL. which as you may easily guess closes a file. It receives a file pointer as an argument which is the file you want to close. This file must have been previously opened by fopen. This function returns zero on success or EOF on failure. Finally we have a series of functions for reading from files and writing into files. Remember get char and put char? Well get C and put C are the more general functions where you get to specify the file or character stream used to get or put a single character. The same applies to fgets and fputs which get and put a null terminated string specifying the target file output for files like fprintf and fscanf.

Contents