C++ Header Files and their Functions :

What is library in C++ Language ?

In a programming language, a library is a collection of subprograms used to develop software. Libraries are not independent programs, rather they are helper code used in other independent programs.

C++ Header Files :

The C++ standard library contains files containing the standard functions that your program may use. Header files provide function prototypes, definitions for library functions. Let us discuss some important header files :

stdio.h

This header file defines types and macros needed for the standard I/O packed. When you include iostream ( iostream.h ) file in your program, this file stdio.h automatically gets included in your program. The standard I/O functions contained in stdio.h are given below :

  1. clearerr
  2. fclose
  3. fcloseall
  4. fdopen
  5. feof
  6. ferror
  7. fflush
  8. fgetc
  9. fgetchar
  10. fgetpos
  11. fgets
  12. fileno
  13. flushall
  14. fopen
  15. fprintf
  16. fputc
  17. fputchar
  18. fputs
  19. fread
  20. freopen
  21. fscanf
  22. fseek
  23. fsetpos
  24. fsopen
  25. ftell
  26. fwrite
  27. getc
  28. getchar
  29. gets
  30. getw
  31. perror
  32. printf
  33. putc
  34. putchar
  35. puts
  36. putw
  37. remove
  38. rename
  39. rewind
  40. rmtmp
  41. scanf
  42. setbuf
  43. setvbuf
  44. sprintf
  45. -streror
  46. strerror
  47. tempnam
  48. tmpfile
  49. tmpram
  50. ungetc
  51. vfrintf
  52. vscanf
  53. vprintf
  54. vscanf
  55. vsprintf

string.h

This header file declares several string manipulation and memory manipulation routines. The functions contained in string.h are :

  1. memccpy
  2. memchr
  3. memcmp
  4. memcpy
  5. memicmp
  6. memmove
  7. memset
  8. movedata
  9. movemem
  10. stpcp
  11. strcat
  12. strchr
  13. strcmp
  14. strcoll
  15. strcpy
  16. strcspn
  17. strdup
  18. strerror
  19. stricmp
  20. strcmpi
  21. strlen
  22. strlwr
  23. strncat
  24. strncmp
  25. strncmpi
  26. stncpy
  27. strnicmp
  28. strnset
  29. strpbrk
  30. strrchr
  31. strrew
  32. strset
  33. strspm
  34. strstr
  35. strtok
  36. strupr
  37. strxfrm

math.h

This header file declares prototypes for the math functions and math error handlers. The routines in math.h file perform mathematical calculations and conversions.

  1. acos
  2. acosl
  3. asin
  4. asinl
  5. atan
  6. atanl
  7. atan2
  8. atan21
  9. atof
  10. atof
  11. cabs
  12. cabsl
  13. ceil
  14. ceill
  15. cos
  16. cosl
  17. cosh
  18. cosh1
  19. div
  20. exp
  21. expl
  22. fabs
  23. fabsl
  24. fevt
  25. floor
  26. floorl
  27. fmod
  28. fmodl
  29. frexp
  30. fexpl
  31. hypot
  32. hypoll
  33. dexp
  34. ldexpl
  35. ldiv
  36. log
  37. logl
  38. logio
  39. log101
  40. matherr
  41. _matherrl
  42. modf
  43. modfl
  44. poly
  45. poly1
  46. pow
  47. polywl
  48. powlo
  49. pow101
  50. sin
  51. sinl
  52. sinh
  53. sinh1
  54. sqrt
  55. sqrtl
  56. tan
  57. tanl
  58. tanh
  59. tanhl

stdlib.h

This header file declares several commonly used routines like conversion routines, search/sort routines, and other miscellaneous things. Some of its functions are :

  1. _fullpath
  2. _makepath
  3. _searchenv
  4. _splitpath
  5. atof
  6. atoi
  7. atol
  8. ecvt
  9. fcvt
  10. gcvt
  11. itoa
  12. Itoa
  13. _strdate
  14. _strtime
  15. strtod
  16. strtol
  17. _strtoid
  18. strtoul
  19. ultoa
  20. mblen
  21. mbtowc
  22. _wcstombs
  23. wctomb
  24. abs
  25. labs
  26. _irotl
  27. _irotr
  28. calloc
  29. coreleft
  30. free
  31. malloc
  32. realloc

iostream.h

This header file declares the basic C++ streams I/O routines. Some of the functions defined in it are :

  1. open
  2. close
  3. get
  4. getline
  5. read
  6. write
  7. put
  8. seekg
  9. seekp
  10. tellg
  11. tellp
  12. ignore
  13. peek
  14. putback
  15. flush
  16. rdstate
  17. bad
  18. eof
  19. fail
  20. good
  21. clear

iomanip.h

This file declares the C++ streams I/O manipulation and contains macros for creating parameter manipulators. Some of its functions are :

  1. dec
  2. endl
  3. ends
  4. flush
  5. hex
  6. oct
  7. reset
  8. osflags
  9. setbase
  10. setfile
  11. setiosflags
  12. setprecision
  13. setw
  14. ws


Note : Here we mix/shuffle all header file's options with 2 colors , cause if all options is belong some color then we think some time reader confused which one he read or which one not (mistake) so, here we use 2 type colors.


Computer Science Engineering

Special Notes

It's a special area where you can find special questions and answers for CSE students or IT professionals. Also, In this section, we try to explain a topic in a very deep way.

CSE Notes