C标准库
// 摘自:Wikipedia.org
C语言的标准文文件要求了一个平台移植C语言的时候至少要实现的一些功能和封装的集合,称为“标准库”,标准库的声明头部通过预处理器命令#include进行引用。
在C89标准中:
01. <assert.h>
02. <ctype.h>
03. <errno.h>
04. <float.h>
05. <limits.h>
06. <locale.h>
07. <math.h>
08. <setjmp.h>
09. <signal.h>
10. <stdarg.h>
11. <stddef.h>
12. <stdio.h>
13. <stdlib.h>
14. <string.h>
15. <time.h>
在C95年的修正版中:
01. <iso646.h>
02. <wchar.h>
03. <wctype.h>
在C99中增加了六个库:
01. <complex.h>
02. <fenv.h>
03. <inttypes.h>
04. <stdbool.h>
05. <stdint.h>
06. <tgmath.h>
以上是C语言的标准,共24个。而各个平台各自又对C库函数进行的各种扩充,就浩如烟海了。如POSIX C、GNU C等。
相关文档:
Boss说,要看OpenGL,看了快一个月,总算出了个像样的东西,用C写了个3D迷宫,
虽然只有350行
代码,不过边学边写,足足写了一周时间,还是小有成就感的,活活活!
&n ......
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#define MAX 1024
int get_file_count(char *root)
{
DIR *dir;
struct dirent * ptr;
int total = 0;
char path[MAX];
dir = opendir(root ......
来自:http://blogger.org.cn/blog/more.asp?name=binaryluo&id=11408
C文件操作遇到的状况
1.将一个文件读到另一个文件,用“(ch = getc(fp)) != EOF”来判断文件是否结束,如果文件是全英文文本的话绝对没问题,新文件的大小和原文件大小一样;但是如果是一些有中文字符或者是二进制 ......
来自:http://zhangjunhd.blog.51cto.com/113473/100299
1.读写字符函数putc()与getc()
这两个函数类似于putchar()与getchar()函数。假设fp是一个FILE指针,ch是一个字符变量,
ch = getc(fp);// ch = getchar();
putc(ch,fp);// putchar(ch);
将文件内容(按字符)输出到标准输出的C实现:
#include <stdio.h ......
由于程序运行时占用的内存过大,所以想办法给程序瘦身。
在调试中发现结构体占用的size竟然和预想的不一样,原来……
看看下面讲的吧,肯定会不枉此看哦!
1,比如:
struct{
short a1;
short a2;
short a3;
}A;
struct{
......