C语言常用库函数示例与说明

参考资料:

  • The GNU C Standard Library Reference Manual: https://www.gnu.org/software/libc/manual/pdf/libc.pdf
  • C Language Reference at cppreference.com https://en.cppreference.com/w/c
  • C Standard Library Headers at cppreference.com https://en.cppreference.com/w/c/header
  • Microsoft’s C Language Reference: https://docs.microsoft.com/en-us/cpp/c-language/c-language- reference

1、输入输出类

标准输入输出类(控制台IO)<stdio.h>

  • printf
  • scanf
  • scanf_s
  • getchar
  • putchar
  • puts
  • gets (不建议使用)

文件输入输出类 <stdio.h>

  • fopen
  • fclose
  • fread
  • fwrite
  • fgets
  • fputs
  • fscanf
  • fprintf
  • fseek
  • ftell
  • rewind
  • feof
  • ferror
  • clearerr

低级输入输出类(POSIX系统)<unistd.h>

  • read
  • write
  • open
  • close

2、字符串转换数值类

字符串转换为整数 <stdlib.h>

  • atoi
  • strtol
  • strtoul
  • strtoull

字符串转换为浮点数 <stdlib.h>

  • atof
  • strtof
  • strtod
  • strtold

字符串转其他 <stdio.h>

  • sscanf
生成海报

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注