天天看点

stdio.h,io.h,STDLIB.h简单说明

stdio.h,io.h,STDLIB.h简单说明

​​编者:李国帅​​

背景原因:

能力不够字数来凑,简单说明三个常用头文件。来自旧日志。

三个文件位于

stdio.h定义c标准输入输出:

This file defines the structures, values, macros, and functions used by the level 2 I/O ("standard I/O") routines. [ANSI/System V]
typedef unsigned __int64    size_t;
typedef unsigned short wchar_t;
struct _iobuf {
        char *_ptr;//缓冲区
        int   _cnt;
        char *_base;
        int   _flag;
        int   _file;
        int   _charbuf;
        int   _bufsiz;
        char *_tmpfname;//文件名
        };
typedef struct _iobuf FILE;
FILE *fp;
 
_CRTIMP extern FILE _iob []
#define stdin  (&_iob[0])
#define stdout (&_iob[1])
#define stderr (&_iob[2])      

io.h 低级别IO操作:

--- This file contains the function declarations for the low-level.file handling and I/O functions.
typedef __int64             intptr_t;
typedef __int64   time_t;       /* time value */
struct _finddata_t {
        unsigned    attrib;
        time_t      time_create;    /* -1 for FAT file systems */
        time_t      time_access;    /* -1 for FAT file systems */
        time_t      time_write;
        _fsize_t    size;
        char        name[260];
};
_CRTIMP int __cdecl _access(const char *, int);
_CRTIMP int __cdecl _chmod(const char *, int);
_CRTIMP int __cdecl _chsize(int, long);
_CRTIMP int __cdecl _close(int);
_CRTIMP int __cdecl _commit(int);
_CRTIMP int __cdecl _creat(const char *, int);
_CRTIMP int __cdecl _dup(int);
_CRTIMP int __cdecl _dup2(int, int);
_CRTIMP int __cdecl _eof(int);
_CRTIMP long __cdecl _filelength(int);
_CRTIMP intptr_t __cdecl _findfirst(const char *, struct _finddata_t *);
_CRTIMP int __cdecl _findnext(intptr_t, struct _finddata_t *);
_CRTIMP int __cdecl _findclose(intptr_t);
_CRTIMP int __cdecl _isatty(int);
_CRTIMP int __cdecl _locking(int, int, long);
_CRTIMP long __cdecl _lseek(int, long, int);
_CRTIMP char * __cdecl _mktemp(char *);
_CRTIMP int __cdecl _open(const char *, int, ...);
_CRTIMP int __cdecl _pipe(int *, unsigned int, int);
_CRTIMP int __cdecl _read(int, void *, unsigned int);
_CRTIMP int __cdecl remove(const char *);
_CRTIMP int __cdecl rename(const char *, const char *);
_CRTIMP int __cdecl _setmode(int, int);
_CRTIMP int __cdecl _sopen(const char *, int, int, ...);
_CRTIMP long __cdecl _tell(int);
_CRTIMP int __cdecl _umask(int);
_CRTIMP int __cdecl _unlink(const char *);
_CRTIMP int __cdecl _write(int, const void *, unsigned int);      

STDLIB.H 定义c语言最常用的函数和宏:

#define EXIT_SUCCESS    0
#define EXIT_FAILURE    1
#define _MAX_PATH   260 /* max. length of full pathname */
#define _MAX_DRIVE  3   /* max. length of drive component */
#define _MAX_DIR    256 /* max. length of path component */
#define _MAX_FNAME  256 /* max. length of file name component */
#define _MAX_EXT    256 /* max. length of extension component */
 
errno_t __cdecl _set_errno(_In_ int _Value);
errno_t __cdecl _get_errno(_Out_ int * _Value);
_CRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code);
_Check_return_ _CRTIMP double  __cdecl atof(_In_z_ const char *_String);
_Check_return_ _CRTIMP __int64 __cdecl _atoi64(_In_z_ const char * _String);
_Check_return_ _CRTIMP double __cdecl _wtof(_In_z_ const wchar_t *_Str);
inline long abs(long _X)