c语言cstdio头文件,头文件<cstdio>和<stdio.h>的区别?

这篇博客介绍了C++中的cstdio头文件,它在C++中是对C语言stdio.h头文件的封装。尽管C++不再推荐使用C的类库,但是为了兼容性,仍然支持cstdio。这个头文件包含了对C标准输入输出库的一系列函数的别名,如fclose、printf等,方便在C++环境中使用。
摘要由CSDN通过智能技术生成

满意答案

dcebd7a0de6265b6ccae5ead692f1eab.png

tomvalex

推荐于 2017.11.23

dcebd7a0de6265b6ccae5ead692f1eab.png

采纳率:56%    等级:8

已帮助:112人

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

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

cstdio文件的内容是这样的:

#if

#include

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

说明依预定义不同,包含的内容是不一样的。

00分享举报

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值