C Programming Code Examples C > File Operations Code Examples Count the number of characters in a file Create temp file name in C programming language Program Code to Delete file Delete file in C programming language Double check before erasing Generate a unique temporary filename: tmpnam Get the next character from a stream: how to use fgetc How to read/ write (I/O) Strings in Files - fgets & fputs How to use extern in C programming language Macro in different file Messing about with formatted file I/O Open a file and read its content using fgetc Open a temporary file: how to use tmpfile Print error message: how to use perror Read and write array into file Read formatted data from a stream: how to use fscanf Reading a File in C programming language Reading strings from a file in reverse order Reads files and displays them on the screen: use EOF Redirect the printf to file Reopen a stream with a different file and mode: how to use freopen Reposition file pointer to a saved location: how to use fsetpos Reposition stream's pointer indicator: how to use fseek Reset the file reader pointer Return the current position in a stream: how to use ftell Save string into file: fputs function Save text content into a file Search a set of numbers Set the file pointer to the beginning of a stream: how to use rewind setvbuf: sets the buffer for stream to be buffer, with a size of 'size_t size' strerror(errno) function - in C programming language Substitutes spaces for tabs in a text file and supplies error checking tmpfile: opens a temporary binary file for read/write operations and returns a pointer to the stream Use fprintf function to save Verify the user input and display file content Write a block of data to a stream: how to use fwrite Write and read the entire array in one step Write character to stream: how to use fputc Write character to stream: how to use putc write non string content Write some non-character data to a disk file and read it back Write string to a stream: how to use fputs Write structure into file Writing string to a file in C programming language Writing a character to a file Page 1 Page 2