stdio.h
The `#include ` directive includes the standard input/output (I/O) header file in your C program. The `stdio.h` header provides functions, macros, and types for input and output operations.
Here are some of the commonly used functions provided by `stdio.h`:
1. Input Functions:
- `scanf()`: Reads formatted input from the standard input (keyboard) or a specified stream.
- `fscanf()`: Reads formatted input from a specified stream.
- `getchar()`: Reads a single character from the standard input (keyboard).
- `fgets()`: Reads a line of text from a specified stream.
2. Output Functions:
- `printf()`: Writes formatted output to the standard output (console) or a specified stream.
- `fprintf()`: Writes formatted output to a specified stream.
- `putchar()`: Writes a single character to the standard output (console).
- `puts()`: Writes a string followed by a newline character to the standard output (console).
3. File Operations:
- `fopen()`: Opens a file and returns a file pointer.
- `fclose()`: Closes a file.
- `fread()`: Reads data from a file.
- `fwrite()`: Writes data to a file.
4. File I/O Functions:
- `fgetc()`: Reads a character from a specified file.
- `fputc()`: Writes a character to a specified file.
- `fgets()`: Reads a line of text from a specified file.
- `fputs()`: Writes a string to a specified file.
5. Error Handling:
- `perror()`: Prints a descriptive error message to the standard error (console) output.
- `feof()`: Checks for the end-of-file indicator on a specified stream.
These are just a few examples of the functions provided by `stdio.h`. The header file also includes additional macros, constants, and types related to file I/O and input/output operations.
When you include `stdio.h` in your program, you gain access to these functions and can utilize them to perform input/output operations in your C program.
Comments
Post a Comment