结构体定义typedefstruct_iobuf{char*_ptr;int_cnt;char*_base;int_flag;int_file;int_charbuf;int_bufsiz;char*_tmpfname;}FILE;#endif/*Not_FILE_DEFINED*//**Thestandardfilehandles*/#ifndef__DECLSPEC_SUPPORTEDexternFILE(*_imp___iob)[];/*ApointertoanarrayofFILE*/#define_iob(*_imp___iob)/*AnarrayofFILE*/#else/*__DECLSPEC_SUPPORTED*/__MINGW_IMPORTFILE_iob[];/*AnarrayofFILEimportedfromDLL.*/#endif/*__DECLSPEC_SUPPORTED*/#definestdin(&_iob[STDIN_FILENO])#definestdout(&_iob[STDOUT_FILENO])#definestderr(&_iob[STDERR_FILENO])操作函式定义#ifdef__cplusplusextern"C"{#endif/**FileOperations*/_CRTIMPFILE*__cdeclfopen(constchar*,constchar*);_CRTIMPFILE*__cdeclfreopen(constchar*,constchar*,FILE*);_CRTIMPint__cdeclfflush(FILE*);_CRTIMPint__cdeclfclose(FILE*);/*MSputsremove&rename(butnotwideversions)inio.halso*/_CRTIMPint__cdeclremove(constchar*);_CRTIMPint__cdeclrename(constchar*,constchar*);_CRTIMPFILE*__cdecltmpfile(void);_CRTIMPchar*__cdecltmpnam(char*);#ifndef__STRICT_ANSI___CRTIMPchar*__cdecl_tempnam(constchar*,constchar*);_CRTIMPint__cdecl_rmtmp(void);#ifndefNO_OLDNAMES_CRTIMPchar*__cdecltempnam(constchar*,constchar*);_CRTIMPint__cdeclrmtmp(void);#endif#endif/*__STRICT_ANSI__*/_CRTIMPint__cdeclsetvbuf(FILE*,char*,int,size_t);_CRTIMPvoid__cdeclsetbuf(FILE*,char*);/**FormattedOutput*/_CRTIMPint__cdeclfprintf(FILE*,constchar*,...);_CRTIMPint__cdeclprintf(constchar*,...);_CRTIMPint__cdeclsprintf(char*,constchar*,...);_CRTIMPint__cdecl_snprintf(char*,size_t,constchar*,...);_CRTIMPint__cdeclvfprintf(FILE*,constchar*,__VALIST);_CRTIMPint__cdeclvprintf(constchar*,__VALIST);_CRTIMPint__cdeclvsprintf(char*,constchar*,__VALIST);_CRTIMPint__cdecl_vsnprintf(char*,size_t,constchar*,__VALIST);#ifndef__NO_ISOCEXT/*externsinlibmingwex.a*/int__cdeclsnprintf(char*s,size_tn,constchar*format,...);__CRT_INLINEint__cdeclvsnprintf(char*s,size_tn,constchar*format,__VALISTarg){return_vsnprintf(s,n,format,arg);}int__cdeclvscanf(constchar*__restrict__,__VALIST);int__cdeclvfscanf(FILE*__restrict__,constchar*__restrict__,__VALIST);int__cdeclvsscanf(constchar*__restrict__,constchar*__restrict__,__VALIST);#endif/**FormattedInput*/_CRTIMPint__cdeclfscanf(FILE*,constchar*,...);_CRTIMPint__cdeclscanf(constchar*,...);_CRTIMPint__cdeclsscanf(constchar*,constchar*,...);/**CharacterInputandOutputFunctions*/_CRTIMPint__cdeclfgetc(FILE*);_CRTIMPchar*__cdeclfgets(char*,int,FILE*);_CRTIMPint__cdeclfputc(int,FILE*);_CRTIMPint__cdeclfputs(constchar*,FILE*);_CRTIMPchar*__cdeclgets(char*);_CRTIMPint__cdeclputs(constchar*);_CRTIMPint__cdeclungetc(int,FILE*);/*Traditionally,getcandputcaredefinedasmacros.butthestandarddoesn'tsaythattheymustbemacros.WeuseinlinefunctionsheretoallowthefastversionstobeusedinC++withnamespacequalification,eg.,::getc._filbufand_flsbufarenotthread-safe.*/_CRTIMPint__cdecl_filbuf(FILE*);_CRTIMPint__cdecl_flsbuf(int,FILE*);#if!defined_MT__CRT_INLINEint__cdeclgetc(FILE*__F){return(--__F->_cnt>=0)?(int)(unsignedchar)*__F->_ptr++:_filbuf(__F);}__CRT_INLINEint__cdeclputc(int__c,FILE*__F){return(--__F->_cnt>=0)?(int)(unsignedchar)(*__F->_ptr++=(char)__c):_flsbuf(__c,__F);}__CRT_INLINEint__cdeclgetchar(void){return(--stdin->_cnt>=0)?(int)(unsignedchar)*stdin->_ptr++:_filbuf(stdin);}__CRT_INLINEint__cdeclputchar(int__c){return(--stdout->_cnt>=0)?(int)(unsignedchar)(*stdout->_ptr++=(char)__c):_flsbuf(__c,stdout);}#else/*Uselibraryfunctions.*/_CRTIMPint__cdeclgetc(FILE*);_CRTIMPint__cdeclputc(int,FILE*);_CRTIMPint__cdeclgetchar(void);_CRTIMPint__cdeclputchar(int);#endif/**DirectInputandOutputFunctions*/_CRTIMPsize_t__cdeclfread(void*,size_t,size_t,FILE*);_CRTIMPsize_t__cdeclfwrite(constvoid*,size_t,size_t,FILE*);/**FilePositioningFunctions*/_CRTIMPint__cdeclfseek(FILE*,long,int);_CRTIMPlong__cdeclftell(FILE*);_CRTIMPvoid__cdeclrewind(FILE*);#ifdef__USE_MINGW_FSEEK/*Theseareinlibmingwex.a*//**Workaroundforlimitationsonwin9xwhereafilecontentsare*notzero'doutifyouseekpasttheendandthenwrite.*/int__cdecl__mingw_fseek(FILE*,long,int);int__cdecl__mingw_fwrite(constvoid*,size_t,size_t,FILE*);#definefseek(fp,offset,whence)__mingw_fseek(fp,offset,whence)#definefwrite(buffer,size,count,fp)__mingw_fwrite(buffer,size,count,fp)#endif/*__USE_MINGW_FSEEK*//**Anopaquedatatypeusedforstoringfilepositions...Thecontentsof*thistypeareunknown,butwe(thecompiler)needtoknowthesize*becausetheprogrammerusingfgetposandfsetposwillbesettingaside*storageforfpos_tstructres.ActuallyItestedusingabytearrayand*itisfairlyevidentthatthefpos_ttypeisalong(inCRTDLL.DLL).*Perhapsanunsignedlong?TODO?It'sdefinitelya64-bitnumberin*MSVCRThowever,andfornow`longlong'willdo.*/#ifdef__MSVCRT__typedeflonglongfpos_t;#elsetypedeflongfpos_t;#endif_CRTIMPint__cdeclfgetpos(FILE*,fpos_t*);_CRTIMPint__cdeclfsetpos(FILE*,constfpos_t*);/**ErrorFunctions*/_CRTIMPint__cdeclfeof(FILE*);_CRTIMPint__cdeclferror(FILE*);#ifdef__cplusplusinlineint__cdeclfeof(FILE*__F){return__F->_flag&_IOEOF;}inlineint__cdeclferror(FILE*__F){return__F->_flag&_IOERR;}#else#definefeof(__F)((__F)->_flag&_IOEOF)#defineferror(__F)((__F)->_flag&_IOERR)#endif_CRTIMPvoid__cdeclclearerr(FILE*);_CRTIMPvoid__cdeclperror(constchar*);#ifndef__STRICT_ANSI__/**Pipes*/_CRTIMPFILE*__cdecl_popen(constchar*,constchar*);_CRTIMPint__cdecl_pclose(FILE*);#ifndefNO_OLDNAMES_CRTIMPFILE*__cdeclpopen(constchar*,constchar*);_CRTIMPint__cdeclpclose(FILE*);#endif/**OtherNonANSIfunctions*/_CRTIMPint__cdecl_flushall(void);_CRTIMPint__cdecl_fgetchar(void);_CRTIMPint__cdecl_fputchar(int);_CRTIMPFILE*__cdecl_fdopen(int,constchar*);_CRTIMPint__cdecl_fileno(FILE*);_CRTIMPint__cdecl_fcloseall(void);_CRTIMPFILE*__cdecl_fsopen(constchar*,constchar*,int);#ifdef__MSVCRT___CRTIMPint__cdecl_getmaxstdio(void);_CRTIMPint__cdecl_setmaxstdio(int);#endif#ifndef_NO_OLDNAMES_CRTIMPint__cdeclfgetchar(void);_CRTIMPint__cdeclfputchar(int);_CRTIMPFILE*__cdeclfdopen(int,constchar*);_CRTIMPint__cdeclfileno(FILE*);#endif/*Not_NO_OLDNAMES*/#define_fileno(__F)((__F)->_file)#ifndef_NO_OLDNAMES#definefileno(__F)((__F)->_file)#endif#ifdefined(__MSVCRT__)&&!defined(__NO_MINGW_LFS)#include<sys/types.h>__CRT_INLINEFILE*__cdeclfopen64(constchar*filename,constchar*mode){returnfopen(filename,mode);}int__cdeclfseeko64(FILE*,off64_t,int);#ifdef__USE_MINGW_FSEEKint__cdecl__mingw_fseeko64(FILE*,off64_t,int);#definefseeko64(fp,offset,whence)__mingw_fseeko64(fp,offset,whence)#endif__CRT_INLINEoff64_t__cdeclftello64(FILE*stream){fpos_tpos;if(fgetpos(stream,&pos))return-1LL;elsereturn((off64_t)pos);}#endif/*__NO_MINGW_LFS*/#endif/*Not__STRICT_ANSI__*//*Wideversions*/#ifndef_WSTDIO_DEFINED/*alsoinwchar.h-keepinsync*/_CRTIMPint__cdeclfwprintf(FILE*,constwchar_t*,...);_CRTIMPint__cdeclwprintf(constwchar_t*,...);_CRTIMPint__cdeclswprintf(wchar_t*,constwchar_t*,...);_CRTIMPint__cdecl_snwprintf(wchar_t*,size_t,constwchar_t*,...);_CRTIMPint__cdeclvfwprintf(FILE*,constwchar_t*,__VALIST);_CRTIMPint__cdeclvwprintf(constwchar_t*,__VALIST);_CRTIMPint__cdeclvswprintf(wchar_t*,constwchar_t*,__VALIST);_CRTIMPint__cdecl_vsnwprintf(wchar_t*,size_t,constwchar_t*,__VALIST);_CRTIMPint__cdeclfwscanf(FILE*,constwchar_t*,...);_CRTIMPint__cdeclwscanf(constwchar_t*,...);_CRTIMPint__cdeclswscanf(constwchar_t*,constwchar_t*,...);_CRTIMPwint_t__cdeclfgetwc(FILE*);_CRTIMPwint_t__cdeclfputwc(wchar_t,FILE*);_CRTIMPwint_t__cdeclungetwc(wchar_t,FILE*);#ifdef__MSVCRT___CRTIMPwchar_t*__cdeclfgetws(wchar_t*,int,FILE*);_CRTIMPint__cdeclfputws(constwchar_t*,FILE*);_CRTIMPwint_t__cdeclgetwc(FILE*);_CRTIMPwint_t__cdeclgetwchar(void);_CRTIMPwchar_t*__cdecl_getws(wchar_t*);_CRTIMPwint_t__cdeclputwc(wint_t,FILE*);_CRTIMPint__cdecl_putws(constwchar_t*);_CRTIMPwint_t__cdeclputwchar(wint_t);_CRTIMPFILE*__cdecl_wfdopen(int,wchar_t*);_CRTIMPFILE*__cdecl_wfopen(constwchar_t*,constwchar_t*);_CRTIMPFILE*__cdecl_wfreopen(constwchar_t*,constwchar_t*,FILE*);_CRTIMPFILE*__cdecl_wfsopen(constwchar_t*,constwchar_t*,int);_CRTIMPwchar_t*__cdecl_wtmpnam(wchar_t*);_CRTIMPwchar_t*__cdecl_wtempnam(constwchar_t*,constwchar_t*);_CRTIMPint__cdecl_wrename(constwchar_t*,constwchar_t*);_CRTIMPint__cdecl_wremove(constwchar_t*);_CRTIMPvoid__cdecl_wperror(constwchar_t*);_CRTIMPFILE*__cdecl_wpopen(constwchar_t*,constwchar_t*);#endif/*__MSVCRT__*/#ifndef__NO_ISOCEXT/*externsinlibmingwex.a*/int__cdeclsnwprintf(wchar_t*s,size_tn,constwchar_t*format,...);__CRT_INLINEint__cdeclvsnwprintf(wchar_t*s,size_tn,constwchar_t*format,__VALISTarg){return_vsnwprintf(s,n,format,arg);}int__cdeclvwscanf(constwchar_t*__restrict__,__VALIST);int__cdeclvfwscanf(FILE*__restrict__,constwchar_t*__restrict__,__VALIST);int__cdeclvswscanf(constwchar_t*__restrict__,constwchar_t*__restrict__,__VALIST);#endif#define_WSTDIO_DEFINED#endif/*_WSTDIO_DEFINED*/#ifndef__STRICT_ANSI__#ifdef__MSVCRT__#ifndefNO_OLDNAMES_CRTIMPFILE*__cdeclwpopen(constwchar_t*,constwchar_t*);#endif/*notNO_OLDNAMES*/#endif/*MSVCRTruntime*//**OtherNonANSIwidefunctions*/_CRTIMPwint_t__cdecl_fgetwchar(void);_CRTIMPwint_t__cdecl_fputwchar(wint_t);_CRTIMPint__cdecl_getw(FILE*);_CRTIMPint__cdecl_putw(int,FILE*);#ifndef_NO_OLDNAMES_CRTIMPwint_t__cdeclfgetwchar(void);_CRTIMPwint_t__cdeclfputwchar(wint_t);_CRTIMPint__cdeclgetw(FILE*);_CRTIMPint__cdeclputw(int,FILE*);#endif/*Not_NO_OLDNAMES*/#endif/*__STRICT_ANSI*/#ifdef__cplusplus}#endif#endif/*NotRC_INVOKED*/#endif/*_STDIO_H_*/stdio.h所包含的函式:档案访问fopenfreopenfflushfclose二进制输入/输出freadfwrite非格式化输入/输出fgetc/getcfputc/putcungetcfgetsfputs格式化输入/输出scanf/fscanf/sscanfprintf/fprintf/sprintfperror档案定位ftellfseekfgetposfsetposrewind错误处理feofferror档案操作removerenametmpfile