Function clearerr () [Read more…] about Error-Handling functions in C
Function putw()and getw() in C
Appending Text in a File in C
Appending to a file means adding at the end of the file while keeping the previous contents of the file intact. For this the file open mode is “a”. Program illustrates appending a file. [Read more…] about Appending Text in a File in C
Function ungetc() in C
The function prototype is written in the following manner: [Read more…] about Function ungetc() in C
Function remove() in C
Function rename () in C
This function is used to change the name of file. Its prototype may be written as given below. [Read more…] about Function rename () in C
Function freopen () in C
This function may be used for opening a file in different modes. The function prototype may be written in the following manner: [Read more…] about Function freopen () in C
C Program to use ferror, perror and fputs
To read a string in a file we can use fgets () whose prototype is: [Read more…] about C Program to use ferror, perror and fputs
C Program to create HSC examination marks data file
Let us define a structure student to store the HSC marks data of a student as follows: [Read more…] about C Program to create HSC examination marks data file
C Program to Text file containing prime numbers in a given range
The fscanf () function works as scanf (). The difference is that fscanf () reads a file and not the computer keyboard. prototype: [Read more…] about C Program to Text file containing prime numbers in a given range
The ungetc Function in C
If a character read from an input stream is not appropriate for the current operation, we can push it back to the stream using the ungetc function. A subsequent character read operation (such as fgetc or getc) on that stream will return this character. The prototype of the ungetc function is given below. [Read more…] about The ungetc Function in C
The fgets and fputs Functions in C
The fgets function reads a sequence of character, i. e., a character string from an input stream. Its prototype is given below. [Read more…] about The fgets and fputs Functions in C
C program to fputc Function and the putc Macro
The fputc function and putc macro are used to write a character to an output stream. Their prototypes are given below. [Read more…] about C program to fputc Function and the putc Macro
C program to count the number of characters, words and lines in a text file
Let us use a while loop in conjunction with the getc macro to read a text file character by character as explained in Program. The counting of characters and lines is very straight forward, the code for which is given below. [Read more…] about C program to count the number of characters, words and lines in a text file
The fclose Function in C
When I/O operations on a file are complete, we must close the file using the fclose function. The prototype of this function is as follows: [Read more…] about The fclose Function in C
What is Streams?
The devices used with a computer, such as a keyboard, monitor, printer, hard disk, magnetic tape, etc., have widely varying properties regarding data input and output. To simplify data I/O operations, the C standard library supports a simple mode of input and output based on the concept of a stream. [Read more…] about What is Streams?
File management in C
The getw and putw functions, The fprintf & fscanf functions, Random access to files and fseek function. C supports a number of functions that have the ability to perform basic file operations, which include: [Read more…] about File management in C