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等。
相关文档:
FILE* pFile = fopen("1.txt","w");
fwrite("http://www.886997.com",1,strlen(http://www.886997.com),pFile);
fseek(pFile,0,SEEK_SET); //从文件的开始处覆盖写入
char cStr[100];
memset(cStr,0,sizeof(cStr));
fread(cStr,1,100,pFile);
char *pBuf;
fseek(pFile,0,SEEK_END);
int leng = ftell(pFile);
pBuf ......
函数名与函数指针
一 通常的函数调用
一个通常的函数调用的例子:
//自行包含头文件
void MyFun(int x); //此处的申明也可写成:void MyFun( int );
int main(int argc, char* argv[])
{
MyFun(10); //这里是调用My ......
来自: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 ......