Home > Backend Development > C++ > body text

What are C library functions?

WBOY
Release: 2023-09-11 15:33:28
forward
1440 people have browsed it

What are C library functions?

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 to include header files in our C program. Whenever the program is run and executed, the relevant files are included in the C program.

Header file functions

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

  • Built-in functions in stdio.h

    Let’s take a look at the built-in functions in the stdio.h library function.

    24
    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!

    source:tutorialspoint.com
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template