C 标准库 - <stdio.h>
一般地,在C语言或C++中,会把用来#include的文件的扩展名叫 .h,称其为头文件。 #include文件的目的就是把多个编译单元(也就是c或者cpp文件)公用的内容,单独放在一个文件里减少整体代码尺寸;或者提供跨工程公共代码。
引用方法
简介
stdio .h 头文件定义了三个变量类型、一些宏和各种函数来执行输入和输出。
库变量
下面是头文件 stdio.h 中定义的变量类型:
序号 | 变量 & 描述 |
---|---|
1 | size_t 这是无符号整数类型,它是 sizeof 关键字的结果。 |
2 | FILE 这是一个适合存储文件流信息的对象类型。 |
3 | fpos_t 这是一个适合存储文件中任何位置的对象类型。 |
库宏
下面是头文件 stdio.h 中定义的宏:
序号 | 宏 & 描述 |
---|---|
1 | NULL 这个宏是一个空指针常量的值。 |
2 | _IOFBF、_IOLBF 和 _IONBF 这些宏扩展了带有特定值的整型常量表达式,并适用于 setvbuf 函数的第三个参数。 |
3 | BUFSIZ 这个宏是一个整数,该整数代表了 setbuf 函数使用的缓冲区大小。 |
4 | EOF 这个宏是一个表示已经到达文件结束的负整数。 |
5 | FOPEN_MAX 这个宏是一个整数,该整数代表了系统可以同时打开的文件数量。 |
6 | FILENAME_MAX 这个宏是一个整数,该整数代表了字符数组可以存储的文件名的最大长度。如果实现没有任何限制,则该值应为推荐的最大值。 |
7 | L_tmpnam 这个宏是一个整数,该整数代表了字符数组可以存储的由 tmpnam 函数创建的临时文件名的最大长度。 |
8 | SEEK_CUR、SEEK_END 和 SEEK_SET 这些宏是在These macros are used in the fseek 函数中使用,用于在一个文件中定位不同的位置。 |
9 | TMP_MAX 这个宏是 tmpnam 函数可生成的独特文件名的最大数量。 |
10 | stderr、stdin 和 stdout 这些宏是指向 FILE 类型的指针,分别对应于标准错误、标准输入和标准输出流。 |
库函数
下面是头文件 stdio.h 中定义的函数:
为了更好地理解函数,请按照下面的序列学习这些函数,因为第一个函数中创建的文件会在后续的函数中使用到。
- 标准函数
- int getchar()//从标准输入设备读入一个字符
- int putchar()//向标准输出设备写出一个字符
- int scanf(char*format[,argument…])//从标准输入设备读入格式化后的数据
- int printf(char*format[,argument…])//向标准输出设备输出格式化字符串
- char gets(char*string)//从标准输入设备读入一个字符串
- int puts(char*string)//向标准输出设备输出一个字符串
- int sprintf(char*string,char*format[,…])//把格式化的数据写入某个字符串缓冲区
文件内容
文件说明
- /*
- *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
- #include<stddef.h>
- #define__need___va_list
- #include<stdarg.h>
- #endif/*NotRC_INVOKED*/
- /*Flagsfortheiobufstructure*/
- #define_IOREAD1/*currentlyreading*/
- #define_IOWRT2/*currentlywriting*/
- #define_IORW0x0080/*openedas"r+w"*/
- /*
- *Thethreestandardfilepointersprovidedbytheruntimelibrary.
- *NOTE:Thesewillgotothebit-bucketsilentlyinGUIapplications!
- */
- #defineSTDIN_FILENO0
- #defineSTDOUT_FILENO1
- #defineSTDERR_FILENO2
- /*Returnedbyvariousfunctionsonendoffileconditionorerror.*/
- #defineEOF(-)
- /*
- *Themaximumlengthofafilename.YoushoulduseGetVolumeInformation
- *insteadofthisconstant.Buthey,thisworks.
- *Alsodefinedinio.h.
- */
- #ifndefFILENAME_MAX
- #defineFILENAME_MAX()
- #endif
- /*
- *Themaximumnumberoffilesthatmaybeopenatonce.Ihavesetthisto
- *aconservativenumber.Theactualvaluemaybehigher.
- */
- #defineFOPEN_MAX()
- /*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()
- #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()
- #endif
- #ifndefSEEK_CUR
- #defineSEEK_CUR()
- #endif
- #ifndefSEEK_END
- #defineSEEK_END()
- #endif
- #ifndefRC_INVOKED
- #ifndef__VALIST
- #ifdef__GNUC__
- #define__VALIST__gnuc_va_list
- #else
- #define__VALISTchar*
- #endif
- #endif/*defined__VALIST*/
- /*
- *ThestructureunderlyingtheFILEtype.
- *
- *Somebelievethatnobodyintheirrightmindshouldmakeuseofthe
- *internalsofthisstructure.ProvidedbyPedroA.ArandaGutiirrez
- */
- #ifndef_FILE_DEFINED
- #define_FILE_DEFINED
结构体定义
- 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_SUPPORTED
- externFILE(*_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__cplusplus
- extern"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__cdecl
- vsnprintf(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.butthe
- standarddoesn'tsaythattheymustbemacros.
- Weuseinlinefunctionsheretoallowthefastversions
- tobeusedinC++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>=)
- ?(int)(unsignedchar)*__F->_ptr++
- :_filbuf(__F);
- }
- __CRT_INLINEint__cdeclputc(int__c,FILE*__F)
- {
- return(--__F->_cnt>=)
- ?(int)(unsignedchar)(*__F->_ptr++=(char)__c)
- :_flsbuf(__c,__F);
- }
- __CRT_INLINEint__cdeclgetchar(void)
- {
- return(--stdin->_cnt>=)
- ?(int)(unsignedchar)*stdin->_ptr++
- :_filbuf(stdin);
- }
- __CRT_INLINEint__cdeclputchar(int__c)
- {
- return(--stdout->_cnt>=)
- ?(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;
- #else
- typedeflongfpos_t;
- #endif
- _CRTIMPint__cdeclfgetpos(FILE*,fpos_t*);
- _CRTIMPint__cdeclfsetpos(FILE*,constfpos_t*);
- /*
- *ErrorFunctions
- */
- _CRTIMPint__cdeclfeof(FILE*);
- _CRTIMPint__cdeclferror(FILE*);
- #ifdef__cplusplus
- inlineint__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_FSEEK
- int__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;
- else
- return((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__cdecl
- vsnwprintf(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所包含的函数:
- 文件访问
- fopen
- freopen
- fflush
- fclose
- 二进制输入/输出
- fread
- fwrite
- 非格式化输入/输出
- fgetc/getc
- fputc/putc
- ungetc
- fgets
- fputs
- 格式化输入/输出
- scanf/fscanf/sscanf
- printf/fprintf/sprintf
- perror
- 文件定位
- ftell
- fseek
- fgetpos
- fsetpos
- rewind
- 错误处理
- feof
- ferror
- 文件操作
- remove
- rename
- tmpfile
C 标准库 - <stdio.h>的更多相关文章
- C 标准库 - <setjmp.h>
C 标准库 - <setjmp.h> 简介 setjmp.h 头文件定义了宏 setjmp().函数 longjmp() 和变量类型 jmp_buf,该变量类型会绕过正常的函数调用和返回规 ...
- C 标准库 - ctype.h
C 标准库 - ctype.h This header declares a set of functions to classify and transform individual charact ...
- C 标准库 - string.h
C 标准库 - string.h This header file defines several functions to manipulate C strings and arrays. stri ...
- C 标准库 - <assert.h>
C 标准库 - <assert.h> 简介 C 标准库的 assert.h头文件提供了一个名为 assert 的宏,它可用于验证程序做出的假设,并在假设为假时输出诊断消息. 已定义的宏 a ...
- C 标准库 - <stdarg.h>
C 标准库 - <stdarg.h> 简介 stdarg.h 头文件定义了一个变量类型 va_list 和三个宏,这三个宏可用于在参数个数未知(即参数个数可变)时获取函数中的参数. 可变参 ...
- C 标准库 - <signal.h>
C 标准库 - <signal.h> 简介 signal.h 头文件定义了一个变量类型 sig_atomic_t.两个函数调用和一些宏来处理程序执行期间报告的不同信号. 库变量 下面是头文 ...
- C 标准库 - <math.h>
C 标准库 - <math.h> 简介 math.h 头文件定义了各种数学函数和一个宏.在这个库中所有可用的功能都带有一个 double 类型的参数,且都返回 double类型的结果. 库 ...
- C 标准库 - <locale.h>
C 标准库 - <locale.h> 简介 locale.h 头文件定义了特定地域的设置,比如日期格式和货币符号.接下来我们将介绍一些宏,以及一个重要的结构 struct lconv 和两 ...
- C 标准库 - <limits.h>
C 标准库 - <limits.h> 简介 limits.h 头文件决定了各种变量类型的各种属性.定义在该头文件中的宏限制了各种变量类型(比如 char.int 和 long)的值. 这些 ...
- C 标准库 - <float.h>
C 标准库 - <float.h> 简介 C 标准库的 float.h 头文件包含了一组与浮点值相关的依赖于平台的常量.这些常量是由 ANSI C 提出的,这让程序更具有可移植性.在讲解这 ...
随机推荐
- MySQL数据类型和运算符
mysql支持多种数据类型,主要有下面三种: 数值数据类型 日期/时间类型 字符串类型 整数类型 不同数据类型有不同的取值范围,可存储的值的范围越大,则所需的存储空间也越大. 整数类型主要有: tin ...
- 利用HttpClient写的一个简单页面获取
之前就听说过利用网络爬虫来获取页面,感觉还挺有意思的,要是能进行一下偏好搜索岂不是可以满足一下窥探欲. 后来从一本书上看到用HttpClient来爬取页面,虽然也有源码,但是也没说用的HttpClie ...
- C语言 · 素数求和
算法提高 素数求和 时间限制:1.0s 内存限制:256.0MB 问题描述 输入一个自然数n,求小于等于n的素数之和 样例输入 2 样例输出 2 数据规模和约定 测试样例保证 2 & ...
- Android ListView 长按列表弹出菜单
Android ListView 长按列表弹出菜单 设置长按菜单 listView.setOnCreateContextMenuListener(new View.OnCreateContextMen ...
- lua 的io操作,非常详细
Lua 标准库 - 输入输出处理(input and output facilities) I/O库提供两种不同的方式进行文件处理 1.io表调用方式:使用io表,io.open将返回指定文件的描述, ...
- mysql 存储过程 invoker invoker
方法一:修改存储过程的definer update mysql.proc set definer='root@localhost' where db='db_name'; 方法二:修改sql secu ...
- ftp 长传报错553 可能是选的目录不对
ftp> put /root/20180711tmp.txt /cc.txt local: /root/20180711tmp.txt remote: /cc.txt 200 PORT comm ...
- shell两个数字的运算,一共三个变量
#!/bin/bash #两个数运算的简单脚本 + ,一共三个参数 echo $# #对获取的参数以此判断是否包含[a-zA-Z]的东西,如果包含就退出.因为数字相加不是数字就是加减乘除 for i_ ...
- Windows与Linux下进程间通信技术比较
一般我们写的程序都是以单个进程的方式来运行的,比较少涉及到多进程.特别是在windows下,因为Windows是按照线程来分配CPU时间片的,线程是最小的调度单位,所以在Windows下更多的用到多线 ...
- C++ Primer学习笔记(三) C++中函数是一种类型!!!
C++中函数是一种类型!C++中函数是一种类型!C++中函数是一种类型! 函数名就是变量!函数名就是变量!函数名就是变量! (---20160618最新消息,函数名不是变量名...囧) (---201 ...