Types of Library Functions In C Language : –
Definition of Library Function :
Functions defined previously in the library are called as library functions.
Example :
#include<math.h>
main( )
{
int n , p, ans;
printf(“Enter number and its power”);
scanf(“%d%d”,&n,&p);
ans = pow(n,p);
printf(“%d”,ans);
getch( );
}
Common Library Functions:
stdio.h functions with their work
fclose( ) Closes a stream
fcloseall( ) Closes all open streams
feof( ) Tests if end-of-file has been reached on a stream
fflush( ) Flushes a stream
fgetc( ) Gets a character from a stream
fgetpos( ) Gets the current file pointer position
fsetpos( ) Positions the file pointer of a stream
fgetchar( ) Gets a character from stdin
fgets( ) Gets a string from a stream
fopen( ) Opens a stream
fprintf( ) Send formatted output to stream
fputc( ) Outputs a character to a stream
fputs( ) Outputs a string to a stream
fread( ) Reads data from a stream
fscanf( ) Scans and formats input from a stream
fseek( ) Sets the file pointer to a particular position
ftell( ) Returns the current position of the file pointer
fwrite( ) Writes to a stream
getc( ) gets one character
getchar( ) gets a character from stdin
gets( ) Get a string from stdin
getw( ) gets an integer from stream
printf( ) Send the formatted output to stdin
putc( ) Outputs a character to stdout
putchar( ) Outputs a character on stdout
puts( ) Outputs string and appends a newline character
putw( ) Outputs an integer on a stream
remove( ) Removes a file
rename( ) Renames a file
rewind( ) Brings the file pointer to stream’s beginning
scanf( ) Scans and formats input from stdin