stdio.h头文件解析
引:1、注释信息解读2、部分编译预处理解读①字节对齐预处理命令字节对齐字节对齐命令
②C运行时库预处理③C运行时接口处理
3、3个变量类型①size_t变量类型②FILE变量类型③fpos_t 变量类型
4、10个宏定义①NULL宏定义②EOF宏定义③stderr、stdin 和 stdout宏定义[1]stderr、stdin 和 stdout含义[2]stderr、stdin 和 stdout与fopen()返回值的关系
④限制性宏定义-4个⑤适用于setvbuf 函数的第三个参数的宏-_IOFBF、_IOLBF 和 _IONBF[1]setvbuf()函数原型及其参数[2]宏_IOFBF、_IOLBF 和 _IONBF的含义
⑥随机读取文件中用到的宏-SEEK_CUR、SEEK_END 和 SEEK_SET
5、42个函数①常用的输入/输出函数-6个②文件操作常用函数-23个③缓冲区操作函数-3个④出错检测/标志清除、错误消息输出函数——3个⑤格式化字符串输入/输出函数-7个
附:头文件内容
引:
“stdio.h”头文件中定义了三个变量类型、一些宏和各种函数来执行输入和输出。特别值得注意的是FILE结构体和相关文件操作函数的定义
1、注释信息解读
注释信息部分对stdio.h头文件进行了简要介绍,即:该头文件包含了一些被标准输入输出程序所使用的结构体、值、宏、函数的定义、声明。
2、部分编译预处理解读
有关微软的标准C编译器版本控制、区分操作系统条件编译、C/C++兼容性的编译预处理的编译预处理操作在此不作赘述,可参看:《从String.h头文件看C字符数组》。
①字节对齐预处理命令
先来看“stdio.h”头文件中涉及到“字节对齐”的代码部分,如下所示,
#ifdef _MSC_VER
#pragma pack(push,8)
#endif
上述代码将Win32平台下的微软编译器调整为8字节对齐方式。那么,什么是字节对齐,它又有什么作用呢?
字节对齐
计算机中内存都是按字节划分的,字节对齐就让各类数据在按照特定的规则在内存中排列。如果一个数据在内存中的位置刚好是他自身长度的整数倍,则为字节对齐。 字节对齐的目的在于提升CPU读写数据的效率。例如:假如能保证CPU在访问double类型的数据时,都从8的倍数地址开始,那么读或写一个double类型数据就只需要一次内存操作。否则,我们就可能需要两次内存操作才能完成这个动作,因为数据或许恰好横跨在两个符合对齐要求的8字节内存块上。关于其内部的机制,在此不作深究。
字节对齐命令
如上图所示,可知,上述代码段中语句
#pragma pack(push,8)
是字节对齐命令,作用是:把原来的对齐方式设置压栈,使C编译器按照8个字节的对齐方式。
②C运行时库预处理
在“stdio.h”头文件中有如下代码段,
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else
#define _CRTIMP
#endif
#endif
其中,①“_CRTIMP”是C run time implement的简写,意思是C运行时库的实现。②“#define _CRTIMP __declspec(dllimport)”命令用于导入lib依赖文件中的相关变量信息,相对的,__declspec(dllexport)用于生成dll文件。 上述代码段中主要是告诉使用stdio.h的程序在运行时,应当使用动态的运行时库还是静态的运行时库。
③C运行时接口处理
类似于微软C编译器的版本控制,如下所示的代码段用于对运行时库接口的版本进行控制。
#ifndef _CRTAPI1
#if _MSC_VER >= 800 && _M_IX86 >= 300
#define _CRTAPI1 __cdecl
#else
#define _CRTAPI1
#endif
#endif
3、3个变量类型
①size_t变量类型
参见《从String.h头文件看C字符数组》中相关解释,在此不作赘述。
②FILE变量类型
FILE是用于存储文件流信息的对象类型,为结构体类型,在C语言文件操作中极其重要。具体内容参见《C语言——5种文件读写操作【总结】》。
③fpos_t 变量类型
“fpos_t”是一个适合存储文件中任何位置的对象类型,下面是其在“stdio.h”头文件中的定义,
#ifndef _FPOS_T_DEFINED
#undef _FPOSOFF
#if defined (_POSIX_)
typedef long fpos_t
;
#else
#if !__STDC__ && _INTEGRAL_MAX_BITS >= 64
typedef __int64 fpos_t
;
#define _FPOSOFF(fp) ((long)(fp))
#else
typedef struct fpos_t
{
unsigned int lopart
;
int hipart
;
} fpos_t
;
#define _FPOSOFF(fp) ((long)(fp).lopart)
#endif
#endif
#define _FPOS_T_DEFINED
#endif
上述定义中,"STDC"宏为ANSIC标准定义的6种可供C语言使用的预定义宏中的一个,除此之外还包括以下几个预定义宏。 可通过程序将其打印出来,下面为示例代码,(VC++6.0/VS2013都提示未定义标识符_STDC__,原因???)
void printGrands(){
printf("__LINE__=%d\n",__LINE__);
printf("__DATE__=%s\n",__DATE__);
printf("__FILE__=%s\n",__FILE__);
printf("__TIME__=%d\n",__TIME__);
#if defined (__STDC__)
printf("__STDC__=%d\n",__STDC__
);
#else
printf("%s\n","warning:__STDC is undefined!");
#endif
}
打印结果,
4、10个宏定义
①NULL宏定义
参见《从String.h头文件看C字符数组》。在此不作赘述。
②EOF宏定义
EOF是一个表示已经到达文件结束的负整数,通常用在文件读取过程中,如下例,单个字符的读取示例,其它几种文件读取方式参见《C语言——5种文件读写操作【总结】》
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main(int argu
,char *argv
[])
{
FILE
*f_write
= fopen("C:\\Users\\13241\\Desktop\\test.txt", "w");
if (f_write
==NULL)
{
printf("返回\n");
return -1;
}
char buf
[] = "Hello,world";
for (int i
= 0; i
< sizeof(buf
);i
++)
{
fputc(buf
[i
], f_write
);
}
fclose(f_write
);
FILE
*f_read
= fopen("C:\\Users\\13241\\Desktop\\test.txt","r");
if (f_read
==NULL)
{
printf("返回\n");
return -1;
}
char ch
= ' ';
while ((ch
= fgetc(f_read
))!=EOF)
{
printf("%c",ch
);
}
fclose(f_read
);
system("pause");
return 0;
}
③stderr、stdin 和 stdout宏定义
#define stdin (&_iob[0])
#define stdout (&_iob[1])
#define stderr (&_iob[2])
上述为这三个宏在“stdio.h”头文件中的定义,它们是指向 FILE 类型的指针,分别对应于标准错误、标准输入和标准输出流。下面对其进行详细介绍。
[1]stderr、stdin 和 stdout含义
在每个C语言程序运行时,系统就会自动打开3个标准文件:标准输入(键盘)、标准输出(显示器)、标准错误输出(显示器),[要注意:这里的文件指的是设备,因为C语言将设备看作是文件,然后进行各种读写操作],上述三个标准文件/设备就对应于这三个宏定义。
(
1)
**stdin:** 是标准输入设备(键盘),一般指键盘输入到缓冲区里的东西。
(
2)
**stdout:** 是标准输出设备,C语言中的
stdout 是一个定义在
<stdio
.h
>的宏(macro),它展开到一个 FILE
* (“指向 FILE 的指针”)类型的表达式(不一定是常量),这个表达式指向一个与标准输出流(standard output stream)相关连的 FILE 对象。
(
3)
**stderr:** 是标准错误输出设备,【unix】标准输出
(设备
)文件,对应终端的屏幕。进程将从标准输入文件中得到输入数据,将正常输出数据输出到标准输出文件,而将错误信息送到标准错误文件中。在C中,程序执行时,一直处于开启状态。
[2]stderr、stdin 和 stdout与fopen()返回值的关系
用一句话描述这种关系就是:fopen()用于打开指定路径和指定访问模式的文件,并返回一个FILE类型的指针。而stderr、stdin 和 stdout这三者又默认指向该FILEL类型的指针变量。其中: ①stdin-standard in表示标准输入,如从键盘或文件输入,经过缓冲区将其内容读取到内存中去; ②stdout-standard out表示标准输出,输出内容会先被加载到缓冲区,在读取到换行符、缓冲区满、fflush或者文件关闭(程序返回退出)的时候就会将缓冲区中的内容输,如输出缓冲区内容到显示屏或文件中; ③stderr-standard error表示标准错误,错误信息不会被加载到缓冲区,会直接进行输出。 关于标准输入、标准输出,可参见《什么是标准输入、标准输出(stdin、stdout)?》中的解释。
④限制性宏定义-4个
这里为了方便对stdio.h头文件中其他宏定义的介绍,暂时将以下几个宏定义归类为“限制性宏定义”,因为它们对C语言中的输入/输出操作做出了一些限制。
【
1】FOPEN_MAX 这个宏是一个整数,该整数代表了系统可以同时打开的文件数量。即对:
fopen()函数的操作限制
【
2】BUFSIZ 这个宏是一个整数,该整数代表了 setbuf 函数使用的缓冲区大小。可通过
printf()函数将其打印出来,VC
++6.0中打印结果为
512,即:BUFSIZ指定缓冲区大小为
512.
【
3】L_tmpnam 这个宏是一个整数,该整数代表了字符数组可以存储的由 tmpnam 函数创建的临时文件名的最大长度。即对:
tmpnam()函数的操作限制
【
4】TMP_MAX 这个宏是 tmpnam 函数可生成的独特文件名的最大数量。即对:
tmpnam()函数的操作限制
【
5】FILENAME_MAX 这个宏是一个整数,该整数代表了字符数组可以存储的文件名的最大长度。如果实现没有任何限制,则该值应为推荐的最大值。
⑤适用于setvbuf 函数的第三个参数的宏-_IOFBF、_IOLBF 和 _IONBF
上述三个宏均可使用于setvbuf()函数的第三个参数的设置。在stdio.h头文件中定义如下,
#define _IOFBF 0x0000
#define _IOLBF 0x0040
#define _IONBF 0x0004
[1]setvbuf()函数原型及其参数
下面来看一下函数setvbuf()的原型与参数,
函数
setvbuf()用来设定文件流的缓冲区,其原型为:
int setvbuf(FILE
* stream
, char * buf
, int type
, unsigned size
);
【参数】stream为文件流指针,buf为缓冲区首地址,type为缓冲区类型,size为缓冲区内字节的数量。
[2]宏_IOFBF、_IOLBF 和 _IONBF的含义
上面已经提到,这三个宏可用于填充函数setvbuf()的第三个参数:type,其含义如下:
①_IOFBF
(满缓冲
):当缓冲区为空时,从流读入数据。或当缓冲区满时,向流写入数据。
②_IOLBF
(行缓冲
):每次从流中读入一行数据或向流中写入—行数据。
③_IONBF
(无缓冲
):直接从流中读入数据或直接向流中写入数据,而没有缓冲区。
在使用这三个宏设置完type参数后,可通过该函数的返回值获取是否设置成功。
⑥随机读取文件中用到的宏-SEEK_CUR、SEEK_END 和 SEEK_SET
这些宏是在随即读取文件操作过程中,配合 fseek 函数使用,用于在一个文件中定位不同的位置。
5、42个函数
为了方便说明,这里将其分为常用输出函数与文件操作过程中用到的输出函数。
①常用的输入/输出函数-6个
这部分函数主要用于从标准输入设备(键盘)读取信息或者向标准输出设备输出信息。
(
1)标准输入输出函数
【
1】
int scanf(const char *format
, ...)从标准输入
stdin 读取格式化输入。
【
2】
int printf(const char *format
, ...);发送格式化输出到标准输出
stdout。
(
2)字符输入输出函数
【
3】
int getchar(void);从标准输入
stdin 获取一个字符(一个无符号字符)。
【
4】
int putchar(int char);把参数
char 指定的字符(一个无符号字符)写入到标准输出
stdout 中。
(
3)字符数组
/字符串输入输出函数
【
5】
char *gets(char *str
)从标准输入
stdin 读取一行,并把它存储在 str 所指向的字符串中。当读取到换行符时,或者到达文件末尾时,它会停止,具体视情况而定。
【
6】
int puts(const char *str
)把一个字符串写入到标准输出
stdout,直到空字符,但不包括空字符。换行符会被追加到输出中。
②文件操作常用函数-23个
这部分函数主要是用于物理文件的打开、读取/写入、关闭,以及文件指针的位置控制、缓冲区设置/刷新等操作。
(
1)文件的打开和关闭
【
1】FILE
*fopen(const char *filename
, const char *mode
);使用给定的模式 mode 打开 filename 所指向的文件。如果文件不存在,则会自动进行创建
【
2】
int fclose(FILE
*stream
);关闭流 stream。刷新所有的缓冲区。
(
2)文件的读写操作
【
3】
int fgetc(FILE
*stream
);从指定的流 stream 获取下一个字符(一个无符号字符),并把位置标识符往前移动。
【
4】
int fputc(int char, FILE
*stream
);把参数
char 指定的字符(一个无符号字符)写入到指定的流 stream 中,并把位置标识符往前移动。
【
5】
char *fgets(char *str
, int n
, FILE
*stream
);从指定的流 stream 读取一行,并把它存储在 str 所指向的字符串内。当读取到文件末尾
EOF或者换行符时,它会停止,具体视情况而定。
【
6】
int fputs(const char *str
, FILE
*stream
);把字符串写入到指定的流 stream 中,但不包括空字符。
【
7】size_t
fread(void *ptr
, size_t size
, size_t nmemb
, FILE
*stream
);从给定流 stream 读取数据到 ptr 所指向的数组中。
【
8】size_t
fwrite(const void *ptr
, size_t size
, size_t nmemb
, FILE
*stream
)把 ptr 所指向的数组中的数据写入到给定流 stream 中。
【
9】
int fprintf(FILE
*stream
, const char *format
, ...);发送格式化输出到流 stream 中。
【
10】
int fscanf(FILE
*stream
, const char *format
, ...);从流 stream 读取格式化输入。
(
3)文件指针的控制
【
11】
int fseek(FILE
*stream
, long int offset
, int whence
)设置流 stream 的文件位置为给定的偏移 offset,参数 offset 意味着从给定的 whence 位置查找的字节数。(配合宏
SEEK_SET、
SEEK_CUR、
SEEK_END使用)
【
12】
long int ftell(FILE
*stream
);返回给定流 stream 的当前文件位置。
【
13】
void rewind(FILE
*stream
);设置文件位置为给定流 stream 的文件的开头。
【
14】
int fgetpos(FILE
*stream
, fpos_t
*pos
);获取流 stream 的当前文件位置,并把它写入到 pos。
【
15】
int fsetpos(FILE
*stream
, const fpos_t
*pos
);设置给定流 stream 的文件位置为给定的位置。参数 pos 是由函数 fgetpos 给定的位置。
【
16】
int feof(FILE
*stream
);测试给定流 stream 的文件结束标识符。
(
4)文件的关联与删除、重命名、创建等
【
17】FILE
*freopen(const char *filename
, const char *mode
, FILE
*stream
);把一个新的文件名 filename 与给定的打开的流 stream 关联,同时关闭流中的旧文件。
【
18】
int remove(const char *filename
);删除给定的文件名 filename,以便它不再被访问。
【
19】
int rename(const char *old_filename
, const char *new_filename
);把 old_filename 所指向的文件名改为 new_filename。
【
20】FILE
*tmpfile(void);以二进制更新模式
(wb
+)创建临时文件。程序退出后自动失效
【
21】
char *tmpnam(char *str
);生成并返回一个有效的临时文件名,该文件名之前是不存在的。
(5)补充:文件的读写操作函数
【
22】
int getc(FILE
*stream
);从指定的流 stream 获取下一个字符(一个无符号字符),并把位置标识符往前移动。
【
23】
int putc(int char, FILE
*stream
)、;把参数
char 指定的字符(一个无符号字符)写入到指定的流 stream 中,并把位置标识符往前移动。
③缓冲区操作函数-3个
主要用于缓冲区的刷新(是缓冲区内容流向标准输入/标准输出设备)以及缓冲方式的重新指定。
【
1】
int fflush(FILE
*stream
);刷新流 stream 的输出缓冲区。
【
2】
void setbuf(FILE
*stream
, char *buffer
);定义流 stream 应如何缓冲。
【
3】
int setvbuf(FILE
*stream
, char *buffer
, int mode
, size_t size
);另一个定义流 stream 应如何缓冲的函数。配合宏_IOFBF、_IOLBF 和 _IONBF来指定缓冲形式。
④出错检测/标志清除、错误消息输出函数——3个
主要用于文件操作过程中的错误提示及其错误消息的输出等。
【
1】
void clearerr(FILE
*stream
);清除给定流 stream 的文件结束和错误标识符。
【
2】
int ferror(FILE
*stream
);测试给定流 stream 的错误标识符。
【
3】
void perror(const char *str
);把一个描述性错误消息输出到标准错误
stderr。首先输出字符串 str,后跟一个冒号,然后是一个空格。
⑤格式化字符串输入/输出函数-7个
【
1】
int sprintf(char *str
, const char *format
, ...);发送格式化输出到字符串。
【
2】
int vfprintf(FILE
*stream
, const char *format
, va_list arg
);使用参数列表发送格式化输出到流 stream 中。
【
3】
int vprintf(const char *format
, va_list arg
);使用参数列表发送格式化输出到标准输出
stdout。
【
4】
int vsprintf(char *str
, const char *format
, va_list arg
);使用参数列表发送格式化输出到字符串。
【
5】
int sscanf(const char *str
, const char *format
, ...);从字符串读取格式化输入。
【
6】
int ungetc(int char, FILE
*stream
);把字符
char(一个无符号字符)推入到指定的流 stream 中,以便它是下一个被读取到的字符。
【
7】
int snprintf(char *str
, size_t size
, const char *format
, ...);格式字符串到 str 中。
附:头文件内容
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_STDIO
#define _INC_STDIO
#if !defined(_WIN32) && !defined(_MAC)
#error ERROR: Only Mac or Win32 targets supported!
#endif
#ifdef _MSC_VER
#pragma pack(push,8)
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else
#define _CRTIMP
#endif
#endif
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _CRTAPI1
#if _MSC_VER >= 800 && _M_IX86 >= 300
#define _CRTAPI1 __cdecl
#else
#define _CRTAPI1
#endif
#endif
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t
;
#define _SIZE_T_DEFINED
#endif
#ifndef _MAC
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t
;
#define _WCHAR_T_DEFINED
#endif
#ifndef _WCTYPE_T_DEFINED
typedef wchar_t wint_t
;
typedef wchar_t wctype_t
;
#define _WCTYPE_T_DEFINED
#endif
#endif
#ifndef _VA_LIST_DEFINED
#ifdef _M_ALPHA
typedef struct {
char *a0
;
int offset
;
} va_list
;
#else
typedef char * va_list
;
#endif
#define _VA_LIST_DEFINED
#endif
#if defined(_M_MPPC)
#define BUFSIZ 4096
#else
#define BUFSIZ 512
#endif
#define _NFILE _NSTREAM_
#ifdef _WIN32
#define _NSTREAM_ 512
#define _IOB_ENTRIES 20
#else
#ifdef _DLL
#define _NSTREAM_ 128
#else
#ifdef _MT
#define _NSTREAM_ 40
#else
#define _NSTREAM_ 20
#endif
#endif
#endif
#define EOF (-1)
#ifndef _FILE_DEFINED
struct _iobuf
{
char *_ptr
;
int _cnt
;
char *_base
;
int _flag
;
int _file
;
int _charbuf
;
int _bufsiz
;
char *_tmpfname
;
};
typedef struct _iobuf FILE
;
#define _FILE_DEFINED
#endif
#ifndef _MAC
#ifdef _POSIX_
#define _P_tmpdir "/"
#define _wP_tmpdir L"/"
#else
#define _P_tmpdir "\\"
#define _wP_tmpdir L"\\"
#endif
#define L_tmpnam sizeof(_P_tmpdir)+12
#else
#define L_tmpnam 255
#endif
#ifdef _POSIX_
#define L_ctermid 9
#define L_cuserid 32
#endif
#define SEEK_CUR 1
#define SEEK_END 2
#define SEEK_SET 0
#define FILENAME_MAX 260
#define FOPEN_MAX 20
#define _SYS_OPEN 20
#define TMP_MAX 32767
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#ifndef _STDIO_DEFINED
_CRTIMP
extern FILE _iob
[];
#endif
#ifndef _FPOS_T_DEFINED
#undef _FPOSOFF
#if defined (_POSIX_)
typedef long fpos_t
;
#else
#if !__STDC__ && _INTEGRAL_MAX_BITS >= 64
typedef __int64 fpos_t
;
#define _FPOSOFF(fp) ((long)(fp))
#else
typedef struct fpos_t
{
unsigned int lopart
;
int hipart
;
} fpos_t
;
#define _FPOSOFF(fp) ((long)(fp).lopart)
#endif
#endif
#define _FPOS_T_DEFINED
#endif
#define stdin (&_iob[0])
#define stdout (&_iob[1])
#define stderr (&_iob[2])
#define _IOREAD 0x0001
#define _IOWRT 0x0002
#define _IOFBF 0x0000
#define _IOLBF 0x0040
#define _IONBF 0x0004
#define _IOMYBUF 0x0008
#define _IOEOF 0x0010
#define _IOERR 0x0020
#define _IOSTRG 0x0040
#define _IORW 0x0080
#ifdef _POSIX_
#define _IOAPPEND 0x0200
#endif
#ifndef _STDIO_DEFINED
_CRTIMP
int __cdecl
_filbuf(FILE
*);
_CRTIMP
int __cdecl
_flsbuf(int, FILE
*);
#ifdef _POSIX_
_CRTIMP FILE
* __cdecl
_fsopen(const char *, const char *);
#else
_CRTIMP FILE
* __cdecl
_fsopen(const char *, const char *, int);
#endif
_CRTIMP
void __cdecl
clearerr(FILE
*);
_CRTIMP
int __cdecl
fclose(FILE
*);
_CRTIMP
int __cdecl
_fcloseall(void);
#ifdef _POSIX_
_CRTIMP FILE
* __cdecl
fdopen(int, const char *);
#else
_CRTIMP FILE
* __cdecl
_fdopen(int, const char *);
#endif
_CRTIMP
int __cdecl
feof(FILE
*);
_CRTIMP
int __cdecl
ferror(FILE
*);
_CRTIMP
int __cdecl
fflush(FILE
*);
_CRTIMP
int __cdecl
fgetc(FILE
*);
_CRTIMP
int __cdecl
_fgetchar(void);
_CRTIMP
int __cdecl
fgetpos(FILE
*, fpos_t
*);
_CRTIMP
char * __cdecl
fgets(char *, int, FILE
*);
#ifdef _POSIX_
_CRTIMP
int __cdecl
fileno(FILE
*);
#else
_CRTIMP
int __cdecl
_fileno(FILE
*);
#endif
_CRTIMP
int __cdecl
_flushall(void);
_CRTIMP FILE
* __cdecl
fopen(const char *, const char *);
_CRTIMP
int __cdecl
fprintf(FILE
*, const char *, ...);
_CRTIMP
int __cdecl
fputc(int, FILE
*);
_CRTIMP
int __cdecl
_fputchar(int);
_CRTIMP
int __cdecl
fputs(const char *, FILE
*);
_CRTIMP size_t __cdecl
fread(void *, size_t
, size_t
, FILE
*);
_CRTIMP FILE
* __cdecl
freopen(const char *, const char *, FILE
*);
_CRTIMP
int __cdecl
fscanf(FILE
*, const char *, ...);
_CRTIMP
int __cdecl
fsetpos(FILE
*, const fpos_t
*);
_CRTIMP
int __cdecl
fseek(FILE
*, long, int);
_CRTIMP
long __cdecl
ftell(FILE
*);
_CRTIMP size_t __cdecl
fwrite(const void *, size_t
, size_t
, FILE
*);
_CRTIMP
int __cdecl
getc(FILE
*);
_CRTIMP
int __cdecl
getchar(void);
_CRTIMP
int __cdecl
_getmaxstdio(void);
_CRTIMP
char * __cdecl
gets(char *);
_CRTIMP
int __cdecl
_getw(FILE
*);
_CRTIMP
void __cdecl
perror(const char *);
_CRTIMP
int __cdecl
_pclose(FILE
*);
_CRTIMP FILE
* __cdecl
_popen(const char *, const char *);
_CRTIMP
int __cdecl
printf(const char *, ...);
_CRTIMP
int __cdecl
putc(int, FILE
*);
_CRTIMP
int __cdecl
putchar(int);
_CRTIMP
int __cdecl
puts(const char *);
_CRTIMP
int __cdecl
_putw(int, FILE
*);
_CRTIMP
int __cdecl
remove(const char *);
_CRTIMP
int __cdecl
rename(const char *, const char *);
_CRTIMP
void __cdecl
rewind(FILE
*);
_CRTIMP
int __cdecl
_rmtmp(void);
_CRTIMP
int __cdecl
scanf(const char *, ...);
_CRTIMP
void __cdecl
setbuf(FILE
*, char *);
_CRTIMP
int __cdecl
_setmaxstdio(int);
_CRTIMP
int __cdecl
setvbuf(FILE
*, char *, int, size_t
);
_CRTIMP
int __cdecl
_snprintf(char *, size_t
, const char *, ...);
_CRTIMP
int __cdecl
sprintf(char *, const char *, ...);
_CRTIMP
int __cdecl
sscanf(const char *, const char *, ...);
_CRTIMP
char * __cdecl
_tempnam(const char *, const char *);
_CRTIMP FILE
* __cdecl
tmpfile(void);
_CRTIMP
char * __cdecl
tmpnam(char *);
_CRTIMP
int __cdecl
ungetc(int, FILE
*);
_CRTIMP
int __cdecl
_unlink(const char *);
_CRTIMP
int __cdecl
vfprintf(FILE
*, const char *, va_list
);
_CRTIMP
int __cdecl
vprintf(const char *, va_list
);
_CRTIMP
int __cdecl
_vsnprintf(char *, size_t
, const char *, va_list
);
_CRTIMP
int __cdecl
vsprintf(char *, const char *, va_list
);
#ifndef _MAC
#ifndef _WSTDIO_DEFINED
#ifndef WEOF
#define WEOF (wint_t)(0xFFFF)
#endif
#ifdef _POSIX_
_CRTIMP FILE
* __cdecl
_wfsopen(const wchar_t
*, const wchar_t
*);
#else
_CRTIMP FILE
* __cdecl
_wfsopen(const wchar_t
*, const wchar_t
*, int);
#endif
_CRTIMP wint_t __cdecl
fgetwc(FILE
*);
_CRTIMP wint_t __cdecl
_fgetwchar(void);
_CRTIMP wint_t __cdecl
fputwc(wint_t
, FILE
*);
_CRTIMP wint_t __cdecl
_fputwchar(wint_t
);
_CRTIMP wint_t __cdecl
getwc(FILE
*);
_CRTIMP wint_t __cdecl
getwchar(void);
_CRTIMP wint_t __cdecl
putwc(wint_t
, FILE
*);
_CRTIMP wint_t __cdecl
putwchar(wint_t
);
_CRTIMP wint_t __cdecl
ungetwc(wint_t
, FILE
*);
_CRTIMP wchar_t
* __cdecl
fgetws(wchar_t
*, int, FILE
*);
_CRTIMP
int __cdecl
fputws(const wchar_t
*, FILE
*);
_CRTIMP wchar_t
* __cdecl
_getws(wchar_t
*);
_CRTIMP
int __cdecl
_putws(const wchar_t
*);
_CRTIMP
int __cdecl
fwprintf(FILE
*, const wchar_t
*, ...);
_CRTIMP
int __cdecl
wprintf(const wchar_t
*, ...);
_CRTIMP
int __cdecl
_snwprintf(wchar_t
*, size_t
, const wchar_t
*, ...);
_CRTIMP
int __cdecl
swprintf(wchar_t
*, const wchar_t
*, ...);
_CRTIMP
int __cdecl
vfwprintf(FILE
*, const wchar_t
*, va_list
);
_CRTIMP
int __cdecl
vwprintf(const wchar_t
*, va_list
);
_CRTIMP
int __cdecl
_vsnwprintf(wchar_t
*, size_t
, const wchar_t
*, va_list
);
_CRTIMP
int __cdecl
vswprintf(wchar_t
*, const wchar_t
*, va_list
);
_CRTIMP
int __cdecl
fwscanf(FILE
*, const wchar_t
*, ...);
_CRTIMP
int __cdecl
swscanf(const wchar_t
*, const wchar_t
*, ...);
_CRTIMP
int __cdecl
wscanf(const wchar_t
*, ...);
#define getwchar() fgetwc(stdin)
#define putwchar(_c) fputwc((_c),stdout)
#define getwc(_stm) fgetwc(_stm)
#define putwc(_c,_stm) fputwc(_c,_stm)
_CRTIMP FILE
* __cdecl
_wfdopen(int, const wchar_t
*);
_CRTIMP FILE
* __cdecl
_wfopen(const wchar_t
*, const wchar_t
*);
_CRTIMP FILE
* __cdecl
_wfreopen(const wchar_t
*, const wchar_t
*, FILE
*);
_CRTIMP
void __cdecl
_wperror(const wchar_t
*);
_CRTIMP FILE
* __cdecl
_wpopen(const wchar_t
*, const wchar_t
*);
_CRTIMP
int __cdecl
_wremove(const wchar_t
*);
_CRTIMP wchar_t
* __cdecl
_wtempnam(const wchar_t
*, const wchar_t
*);
_CRTIMP wchar_t
* __cdecl
_wtmpnam(wchar_t
*);
#define _WSTDIO_DEFINED
#endif
#endif
#define _STDIO_DEFINED
#endif
#define feof(_stream) ((_stream)->_flag & _IOEOF)
#define ferror(_stream) ((_stream)->_flag & _IOERR)
#define _fileno(_stream) ((_stream)->_file)
#define getc(_stream) (--(_stream)->_cnt >= 0 \
? 0xff & *(_stream)->_ptr++ : _filbuf(_stream))
#define putc(_c,_stream) (--(_stream)->_cnt >= 0 \
? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
#define getchar() getc(stdin)
#define putchar(_c) putc((_c),stdout)
#ifdef _MT
#undef getc
#undef putc
#undef getchar
#undef putchar
#endif
#if !__STDC__ && !defined(_POSIX_)
#define P_tmpdir _P_tmpdir
#define SYS_OPEN _SYS_OPEN
_CRTIMP
int __cdecl
fcloseall(void);
_CRTIMP FILE
* __cdecl
fdopen(int, const char *);
_CRTIMP
int __cdecl
fgetchar(void);
_CRTIMP
int __cdecl
fileno(FILE
*);
_CRTIMP
int __cdecl
flushall(void);
_CRTIMP
int __cdecl
fputchar(int);
_CRTIMP
int __cdecl
getw(FILE
*);
_CRTIMP
int __cdecl
putw(int, FILE
*);
_CRTIMP
int __cdecl
rmtmp(void);
_CRTIMP
char * __cdecl
tempnam(const char *, const char *);
_CRTIMP
int __cdecl
unlink(const char *);
#endif
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif
#endif