Library functions are built-in functions that are grouped together and placed in a common location called a library.
Each function here performs a specific operation. We can use this library function to get predefined output.
All C standard library functions are declared through the use of many header files. These library functions are created when the compiler is designed.
We use #include
Some header file functions are as follows-
stdio.h - This is a standard I/ O Header file in which the input/output functions are declared
conio.h - This is the console input/output header file.
string.h − All string-related functions are in this header file.
stdlib.h − This file contains common functions used in C programs.
math.h - All math related functions are in this header file.
time.h - This file contains time and clock related functions. Built-in functions in stdio.h
Let’s take a look at the built-in functions in the stdio.h library function.
Sl.No | Function and description |
---|---|
1 |
printf() This function is used to print all char, int, float, string and other values to the output screen. |
2 |
scanf() This function is used to read data from the keyboard. |
3 | getc()Read characters from the file. |
4 |
gets() It reads lines from the keyboard. |
5 | getchar()It reads characters from the keyboard. |
6 |
puts() It writes lines to the O/P screen. |
7 |
putchar() p> It writes a character to the screen. |
8 td> |
fopen() All file processing functions are in the stdio.h header defined in the file. |
9 |
fclose () Close the open file. |
10 |
getw() Read an integer from the file.
|
11 |
putw( ) Write integers to the file. |
12 |
fgetc() Read a character from the file.
|
13 |
putc( ) Write a character to the file. |
14 |
fputc() Write characters to a file.
|
15 |
fgets( ) Read strings from a file, one line at a time . |
16 |
f put() Write a string to the file. |
17 |
feof() Find the end of file. |
18 |
fgetchar Read characters from the keyboard. |
19 | fgetc() Read a character from the file. |
20 |
fprintf() Write formatted data to the file. p> |
21 | fscanf() Read formatted data from the file. |
22 |
fputchar Write a character from the keyboard. |
23 | fseek() Move the file pointer to a given location. |
SEEK_SET Moves the file pointer to the beginning of the file. |
|
25 |
SEEK_CUR Moves the file pointer to the given position. |
26 |
SEEK_END Move the file pointer to the end of the file. |
27 |
ftell() gives the current position of the file pointer. |
28 |
Rewind() Moves the file pointer to the beginning of the file. |
29 |
putc() Write characters to the file. |
30 |
sprint() Write formatted output to a string. |
31 |
sscanf() Read formatted input from a string. |
32 |
Delete() Delete the file. |
33 td> |
flush() Refresh the file. |
The above is the detailed content of What are C library functions?. For more information, please follow other related articles on the PHP Chinese website!