stdio.h
- 文件访问
- fopen
- freopen
- fflush
- fclose
- 二进制输入/输出
- fread
- fwrite
- 非格式化输入/输出
- fgetc/getc
- fputc/putc
- ungetc
- fgets
- fputs
- 格式化输入/输出
- scanf/fscanf/sscanf
- printf/fprintf/sprintf
- perror
- 文件定位
- ftell
- fseek
- fgetpos
- fsetpos
- rewind
- 错误处理
- feof
- ferror
- 文件操作
- remove
- rename
- tmpfile
stdlib.h
1 字符串转换
- double atof (const char*);
- int atoi (const char*);
- long atol (const char*);
- double strtod (const char*, char**);
- long strtol (const char*, char**, int);
- unsigned long strtoul (const char*, char**, int);
2 随机数
常量
- #define RAND_MAX 0x7FFF rand的最大返回值
函数
- void srand (unsigned int); 置随机数发生器(种子)
- int rand (void); 返回下一个伪随机数
3 内存管理
常量
- #define NULL ((void *)0) 空指针
函数
- void* calloc (size_t, size_t); 分配内存, 并清零
- void* malloc (size_t); 分配内存
- void* realloc (void*, size_t); 重新分配内存, 返回新指针
- void free (void*); 释放内存
4 与环境的接口
常量
- #define EXIT_SUCCESS 0
- #define EXIT_FAILURE 1
函数
- void abort (void);
- void exit (int);
- int atexit (void (*)(void));
- int system (const char*);
- char* getenv (const char*);
5 查找与排序
- void* bsearch (const void*, const void*, size_t, size_t,
- int (*)(const void*, const void*));
- void qsort (const void*, size_t, size_t,
- int (*)(const void*, const void*));
6 整数运算
结构
- typedef struct { int quot, rem; } div_t;
- typedef struct { long quot, rem; } ldiv_t;
函数
- int abs (int);
- long labs (long);
- div_t div (int, int);
- ldiv_t ldiv (long, long);
7 多字节字符
常量
- MB_CUR_MAX 多字节字符中的最大字节数
函数
- size_t wcstombs (char*, const wchar_t*, size_t);
- int wctomb (char*, wchar_t);
- int mblen (const char*, size_t);
- size_t mbstowcs (wchar_t*, const char*, size_t);
- int mbtowc (wchar_t*, const char*, size_t);