您好,欢迎访问三七文档
stdio.h目录[隐藏]简介使用[编辑本段]简介stdio.h就是指“standardinput&output意思就是说标准输入输出头文件!所以了,用到标准输入输出函数时,就要调用这个头文件![编辑本段]使用调用#includestdio.h或#includestdio.h在TC2.0中,即使不加此文件包含命令也可以编译通过。stdio.h中的标准输入输出函数intgetchar()//从标准输入设备读入一个字符,显示intputchar()//向标准输出设备写一个字符intscanf(char*format[,argument…])//从标准输入设备读入数据intprintf(char*format[,argument…])//格式化字符串输入到标准输出设备intputs(char*string)//输出一个字符串到标准输出设备char*gets(char*string)//从标准输入设备读入一个字符intsprintf(char*string,char*format[,…])//格式化一个字符串输出到字符数组中,不显示stdio.h中内容/**stdio.h*ThisfilehasnocopyrightassignedandisplacedinthePublicDomain.*Thisfileisapartofthemingw-runtimepackage.*Nowarrantyisgiven;refertothefileDISCLAIMERwithinthepackage.**Definitionsoftypesandprototypesoffunctionsforstandardinputand*output.**NOTE:ThefilemanipulationfunctionsprovidedbyMicrosoftseemto*workwitheitherslash(/)orbackslash(\)asthedirectoryseparator.**/#ifndef_STDIO_H_#define_STDIO_H_/*Alltheheadersincludethisfile.*/#include_mingw.h#ifndefRC_INVOKED#define__need_size_t#define__need_NULL#define__need_wchar_t#define__need_wint_t#includestddef.h#define__need___va_list#includestdarg.h#endif/*NotRC_INVOKED*//*Flagsfortheiobufstructure*/#define_IOREAD1/*currentlyreading*/#define_IOWRT2/*currentlywriting*/#define_IORW0x0080/*openedasr+w*//**Thethreestandardfilepointersprovidedbytheruntimelibrary.*NOTE:Thesewillgotothebit-bucketsilentlyinGUIapplications!*/#defineSTDIN_FILENO0#defineSTDOUT_FILENO1#defineSTDERR_FILENO2/*Returnedbyvariousfunctionsonendoffileconditionorerror.*/#defineEOF(-1)/**Themaximumlengthofafilename.YoushoulduseGetVolumeInformation*insteadofthisconstant.Buthey,thisworks.*Alsodefinedinio.h.*/#ifndefFILENAME_MAX#defineFILENAME_MAX(260)#endif/**Themaximumnumberoffilesthatmaybeopenatonce.Ihavesetthisto*aconservativenumber.Theactualvaluemaybehigher.*/#defineFOPEN_MAX(20)/*Aftercreatingthismanynames,tmpnamandtmpfilereturnNULL*/#defineTMP_MAX32767/**Tmpnam,tmpfileand,sometimes,_tempnamtrytocreate*tempfilesintherootdirectoryofthecurrentdrive*(notinpwd,assuggestedbysomeolderMSdoc's).*RedefiningthesemacrosdoesnoteffecttheCRTfunctions.*/#define_P_tmpdir\\#ifndef__STRICT_ANSI__#defineP_tmpdir_P_tmpdir#endif#define_wP_tmpdirL\\/**Themaximumsizeofname(includingNUL)thatwillbeputintheuser*suppliedbuffercaNamefortmpnam.*Inferredfromthesizeofthestaticbufferreturnedbytmpnam*whenpassedaNULLargument.Mayactuallybesmaller.*/#defineL_tmpnam(16)#define_IOFBF0x0000/*fullbuffered*/#define_IOLBF0x0040/*linebuffered*/#define_IONBF0x0004/*notbuffered*/#define_IOMYBUF0x0008/*stdiomalloc()'dbuffer*/#define_IOEOF0x0010/*EOFreachedonread*/#define_IOERR0x0020/*I/Oerrorfromsystem*/#define_IOSTRG0x0040/*Strangeornofiledescriptor*/#ifdef_POSIX_SOURCE#define_IOAPPEND0x0200#endif/**Thebuffersizeasusedbysetbufsuchthatitisequivalentto*(void)setvbuf(fileSetBuffer,caBuffer,_IOFBF,BUFSIZ).*/#defineBUFSIZ512/*ConstantsfornOriginindicatingthepositionrelativetowhichfseek*setsthefileposition.Enclosedinifdefsbecauseio.hcouldalso*definethem.(Thoughnotanymoresinceio.hincludesthisfilenow.)*/#ifndefSEEK_SET#defineSEEK_SET(0)#endif#ifndefSEEK_CUR#defineSEEK_CUR(1)#endif#ifndefSEEK_END#defineSEEK_END(2)#endif#ifndefRC_INVOKED#ifndef__VALIST#ifdef__GNUC__#define__VALIST__gnuc_va_list#else#define__VALISTchar*#endif#endif/*defined__VALIST*//**ThestructureunderlyingtheFILEtype.**Somebelievethatnobodyintheirrightmindshouldmakeuseofthe*internalsofthisstructure.ProvidedbyPedroA.ArandaGutiirrez*paag@tid.es.*/#ifndef_FILE_DEFINED#define_FILE_DEFINEDtypedefstruct_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__cplusplusexternC{#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);_
本文标题:stdio.h
链接地址:https://www.777doc.com/doc-5933357 .html