头文件<cstdio>和<stdio.h>的区别?

如题所述

在C语言中,stdio.h 头文件是主要的。

而在后来的C++语言中,C只是C++的一个子集,且C++中,已不推荐再用C的类库,但为了对已有代码的保护,还是对原来的头文件支持。

cstdio文件的内容是这样的:
#if <TRADITIONAL C HEADERS>
#include <stdio.h>
namespace std {
using ::fclose;
using ::feof;
using ::ferror;
using ::fflush;
using ::fgetc;
using ::fgetpos;
using ::fgets;
using ::FILE;
using ::clearerr;
using ::fopen;
using ::fprintf;
using ::fpos_t;
using ::fputc;
using ::fputs;
using ::fread;
using ::freopen;
using ::fscanf;
using ::fseek;
using ::fsetpos;
using ::ftell;
using ::fwrite;
using ::getc;
using ::getchar;
using ::gets;
using ::perror;
using ::putc;
using ::putchar;
using ::printf;
using ::puts;
using ::remove;
using ::rename;
using ::rewind;
using ::scanf;
using ::setbuf;
using ::setvbuf;
using ::size_t;
using ::sprintf;
using ::sscanf;
using ::tmpfile;
using ::tmpnam;
using ::ungetc;
using ::vfprintf;
using ::vprintf;
using ::vsprintf;
}
#endif

说明依预定义不同,包含的内容是不一样的。
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答