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等。
相关文档:
1. wprintf
Q : sizeof(wchar_t) = ?
A : 随编译器不同。(所以:在需要跨平台的时候尽量不用wchar_t) vc : sizeof(wchar_t) = 2;
Q: 在vc中,为什么直接使用wprintf(L"测试1234")会没有结果
A: 没有设置好locale,这样做
setlocale(LC_ALL ,
"
chs
"
);
wprintf(L
"
%s
"
,L
......
1、隐式转换
C在以下四种情况下会进行隐式转换:
1、算术运算式中,低类型能够转换为高类型。
2、赋值表达式中,右边表达式的值自动隐式转换为左边变量的类型,并赋值给他。
& ......
#include <assert.h> //设定插入点
#include <ctype.h> //字符处理
#include <errno.h> //定义错误码
#include <float.h> //浮点数处理
#include <fstream.h> //文件输入/输出
#include <iomanip.h> //参数化输入/输出
#include & ......
JNI调用可以加快JAVA的运行速度,主要是将关键的代码用C/C++ 或者mfc完成,在这里贴上我写的一段代码,有兴趣的可以参考:
头文件:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class cn_com_wintone_TLConnectJNI */
#ifndef _Included_cn_com_wintone_TLConnectJ ......
#include<stdlib.h>
#include<iostream>
#include<string.h>
using namespace std;
int main(void)
{
FILE *fp, *fp2;
char buf[1024*300];
fp = fopen("in.txt", "rb");
fp2 = fopen("out.txt", "wb+");
fseek(fp, 0, SEEK_END);
int iLen ......