计算机中stdio.h是什么意思有什么作用

2022-07-31 教育 113阅读
stdio.h就是指“standard input&output"
意思就是说标准输入输出头文件!
所以了,用到标准输入输出函数时,就要调用这个头文件!
原程序为:

#ifndef _STDIO_H_
#define _STDIO_H_

#include <_mingw.h>
#ifndef RC_INVOKED
#define __need_size_t
#define __need_NULL
#define __need_wchar_t
#define __need_wint_t
#include
#define __need___va_list
#include
#endif


#define _IOREAD 1
#define _IOWRT 2
#define _IORW 0x0080


#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2

#define EOF (-1)

#ifndef FILENAME_MAX
#define FILENAME_MAX (260)
#endif

#define FOPEN_MAX (20)

#define TMP_MAX 32767

#define _P_tmpdir "\\"
#ifndef __STRICT_ANSI__
#define P_tmpdir _P_tmpdir
#endif
#define _wP_tmpdir L"\\"

#define L_tmpnam (16)
#define _IOFBF 0x0000
#define _IOLBF 0x0040
#define _IONBF 0x0004
#define _IOMYBUF 0x0008
#define _IOEOF 0x0010
#define _IOERR 0x0020
#define _IOSTRG 0x0040
#ifdef _POSIX_SOURCE
# define _IOAPPEND 0x0200
#endif

#define BUFSIZ 512

#ifndef SEEK_SET
#define SEEK_SET (0)
#endif
#ifndef SEEK_CUR
#define SEEK_CUR (1)
#endif
#ifndef SEEK_END
#define SEEK_END (2)
#endif

#ifndef RC_INVOKED
#ifndef __VALIST
#ifdef __GNUC__
#define __VALIST __gnuc_va_list
#else
#define __VALIST char*
#endif
#endif

#ifndef _FILE_DEFINED
#define _FILE_DEFINED
typedef struct _iobuf
{
char* _ptr;
int _cnt;
char* _base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char* _tmpfname;
} FILE;
#endif


#ifndef __DECLSPEC_SUPPORTED
extern FILE (*_imp___iob)[];
#define _iob (*_imp___iob)
#else
__MINGW_IMPORT FILE _iob[];
#endif
#define stdin (&_iob[STDIN_FILENO])
#define stdout (&_iob[STDOUT_FILENO])
#define stderr (&_iob[STDERR_FILENO])
#ifdef __cplusplus
extern "C" {
#endif

_CRTIMP FILE* __cdecl fopen (const char*, const char*);
_CRTIMP FILE* __cdecl freopen (const char*, const char*, FILE*);
_CRTIMP int __cdecl fflush (FILE*);
_CRTIMP int __cdecl fclose (FILE*);

_CRTIMP int __cdecl remove (const char*);
_CRTIMP int __cdecl rename (const char*, const char*);
_CRTIMP FILE* __cdecl tmpfile (void);
_CRTIMP char* __cdecl tmpnam (char*);
#ifndef __STRICT_ANSI__
_CRTIMP char* __cdecl _tempnam (const char*, const char*);
_CRTIMP int __cdecl _rmtmp(void);
#ifndef NO_OLDNAMES
_CRTIMP char* __cdecl tempnam (const char*, const char*);
_CRTIMP int __cdecl rmtmp(void);
#endif
#endif
_CRTIMP int __cdecl setvbuf (FILE*, char*, int, size_t);
_CRTIMP void __cdecl setbuf (FILE*, char*);

_CRTIMP int __cdecl fprintf (FILE*, const char*, ...);
_CRTIMP int __cdecl printf (const char*, ...);
_CRTIMP int __cdecl sprintf (char*, const char*, ...);
_CRTIMP int __cdecl _snprintf (char*, size_t, const char*, ...);
_CRTIMP int __cdecl vfprintf (FILE*, const char*, __VALIST);
_CRTIMP int __cdecl vprintf (const char*, __VALIST);
_CRTIMP int __cdecl vsprintf (char*, const char*, __VALIST);
_CRTIMP int __cdecl _vsnprintf (char*, size_t, const char*, __VALIST);
#ifndef __NO_ISOCEXT
int __cdecl snprintf(char* s, size_t n, const char* format, ...);
__CRT_INLINE int __cdecl
vsnprintf (char* s, size_t n, const char* format, __VALIST arg)
{ return _vsnprintf ( s, n, format, arg); }
int __cdecl vscanf (const char * __restrict__, __VALIST);
int __cdecl vfscanf (FILE * __restrict__, const char * __restrict__,
__VALIST);
int __cdecl vsscanf (const char * __restrict__,
const char * __restrict__, __VALIST);
#endif

_CRTIMP int __cdecl fscanf (FILE*, const char*, ...);
_CRTIMP int __cdecl scanf (const char*, ...);
_CRTIMP int __cdecl sscanf (const char*, const char*, ...);

_CRTIMP int __cdecl fgetc (FILE*);
_CRTIMP char* __cdecl fgets (char*, int, FILE*);
_CRTIMP int __cdecl fputc (int, FILE*);
_CRTIMP int __cdecl fputs (const char*, FILE*);
_CRTIMP char* __cdecl gets (char*);
_CRTIMP int __cdecl puts (const char*);
_CRTIMP int __cdecl ungetc (int, FILE*);

_CRTIMP int __cdecl _filbuf (FILE*);
_CRTIMP int __cdecl _flsbuf (int, FILE*);
#if !defined _MT
__CRT_INLINE int __cdecl getc (FILE* __F)
{
return (--__F->_cnt >= 0)
? (int) (unsigned char) *__F->_ptr++
: _filbuf (__F);
}
__CRT_INLINE int __cdecl putc (int __c, FILE* __F)
{
return (--__F->_cnt >= 0)
? (int) (unsigned char) (*__F->_ptr++ = (char)__c)
: _flsbuf (__c, __F);
}
__CRT_INLINE int __cdecl getchar (void)
{
return (--stdin->_cnt >= 0)
? (int) (unsigned char) *stdin->_ptr++
: _filbuf (stdin);
}
__CRT_INLINE int __cdecl putchar(int __c)
{
return (--stdout->_cnt >= 0)
? (int) (unsigned char) (*stdout->_ptr++ = (char)__c)
: _flsbuf (__c, stdout);}
#else
_CRTIMP int __cdecl getc (FILE*);
_CRTIMP int __cdecl putc (int, FILE*);
_CRTIMP int __cdecl getchar (void);
_CRTIMP int __cdecl putchar (int);
#endif

_CRTIMP size_t __cdecl fread (void*, size_t, size_t, FILE*);
_CRTIMP size_t __cdecl fwrite (const void*, size_t, size_t, FILE*);

_CRTIMP int __cdecl fseek (FILE*, long, int);
_CRTIMP long __cdecl ftell (FILE*);
_CRTIMP void __cdecl rewind (FILE*);
#ifdef __USE_MINGW_FSEEK

int __cdecl __mingw_fseek (FILE *, long, int);
int __cdecl __mingw_fwrite (const void*, size_t, size_t, FILE*);
#define fseek(fp, offset, whence) __mingw_fseek(fp, offset, whence)
#define fwrite(buffer, size, count, fp) __mingw_fwrite(buffer, size, count, fp)
#endif

#ifdef __MSVCRT__
typedef long long fpos_t;
#else
typedef long fpos_t;
#endif
_CRTIMP int __cdecl fgetpos (FILE*, fpos_t*);
_CRTIMP int __cdecl fsetpos (FILE*, const fpos_t*);

_CRTIMP int __cdecl feof (FILE*);
_CRTIMP int __cdecl ferror (FILE*);
#ifdef __cplusplus
inline int __cdecl feof (FILE* __F)
{ return __F->_flag & _IOEOF; }
inline int __cdecl ferror (FILE* __F)
{ return __F->_flag & _IOERR; }
#else
#define feof(__F) ((__F)->_flag & _IOEOF)
#define ferror(__F) ((__F)->_flag & _IOERR)
#endif
_CRTIMP void __cdecl clearerr (FILE*);
_CRTIMP void __cdecl perror (const char*);

#ifndef __STRICT_ANSI__

_CRTIMP FILE* __cdecl _popen (const char*, const char*);
_CRTIMP int __cdecl _pclose (FILE*);
#ifndef NO_OLDNAMES
_CRTIMP FILE* __cdecl popen (const char*, const char*);
_CRTIMP int __cdecl pclose (FILE*);
#endif

_CRTIMP int __cdecl _flushall (void);
_CRTIMP int __cdecl _fgetchar (void);
_CRTIMP int __cdecl _fputchar (int);
_CRTIMP FILE* __cdecl _fdopen (int, const char*);
_CRTIMP int __cdecl _fileno (FILE*);
_CRTIMP int __cdecl _fcloseall(void);
_CRTIMP FILE* __cdecl _fsopen(const char*, const char*, int);
#ifdef __MSVCRT__
_CRTIMP int __cdecl _getmaxstdio(void);
_CRTIMP int __cdecl _setmaxstdio(int);
#endif
#ifndef _NO_OLDNAMES
_CRTIMP int __cdecl fgetchar (void);
_CRTIMP int __cdecl fputchar (int);
_CRTIMP FILE* __cdecl fdopen (int, const char*);
_CRTIMP int __cdecl fileno (FILE*);
#endif
#define _fileno(__F) ((__F)->_file)
#ifndef _NO_OLDNAMES
#define fileno(__F) ((__F)->_file)
#endif
#if defined (__MSVCRT__) && !defined (__NO_MINGW_LFS)
#include
__CRT_INLINE FILE* __cdecl fopen64 (const char* filename, const char* mode)
{
return fopen (filename, mode);
}
int __cdecl fseeko64 (FILE*, off64_t, int);
#ifdef __USE_MINGW_FSEEK
int __cdecl __mingw_fseeko64 (FILE *, off64_t, int);
#define fseeko64(fp, offset, whence) __mingw_fseeko64(fp, offset, whence)
#endif
__CRT_INLINE off64_t __cdecl ftello64 (FILE * stream)
{
fpos_t pos;
if (fgetpos(stream, &pos))
return -1LL;
else
return ((off64_t) pos);
}
#endif
#endif

#ifndef _WSTDIO_DEFINED

_CRTIMP int __cdecl fwprintf (FILE*, const wchar_t*, ...);
_CRTIMP int __cdecl wprintf (const wchar_t*, ...);
_CRTIMP int __cdecl swprintf (wchar_t*, const wchar_t*, ...);
_CRTIMP int __cdecl _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
_CRTIMP int __cdecl vfwprintf (FILE*, const wchar_t*, __VALIST);
_CRTIMP int __cdecl vwprintf (const wchar_t*, __VALIST);
_CRTIMP int __cdecl vswprintf (wchar_t*, const wchar_t*, __VALIST);
_CRTIMP int __cdecl _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
_CRTIMP int __cdecl fwscanf (FILE*, const wchar_t*, ...);
_CRTIMP int __cdecl wscanf (const wchar_t*, ...);
_CRTIMP int __cdecl swscanf (const wchar_t*, const wchar_t*, ...);
_CRTIMP wint_t __cdecl fgetwc (FILE*);
_CRTIMP wint_t __cdecl fputwc (wchar_t, FILE*);
_CRTIMP wint_t __cdecl ungetwc (wchar_t, FILE*);
#ifdef __MSVCRT__
_CRTIMP wchar_t* __cdecl fgetws (wchar_t*, int, FILE*);
_CRTIMP int __cdecl fputws (const wchar_t*, FILE*);
_CRTIMP wint_t __cdecl getwc (FILE*);
_CRTIMP wint_t __cdecl getwchar (void);
_CRTIMP wchar_t* __cdecl _getws (wchar_t*);
_CRTIMP wint_t __cdecl putwc (wint_t, FILE*);
_CRTIMP int __cdecl _putws (const wchar_t*);
_CRTIMP wint_t __cdecl putwchar (wint_t);
_CRTIMP FILE* __cdecl _wfdopen(int, wchar_t *);
_CRTIMP FILE* __cdecl _wfopen (const wchar_t*, const wchar_t*);
_CRTIMP FILE* __cdecl _wfreopen (const wchar_t*, const wchar_t*, FILE*);
_CRTIMP FILE* __cdecl _wfsopen (const wchar_t*, const wchar_t*, int);
_CRTIMP wchar_t* __cdecl _wtmpnam (wchar_t*);
_CRTIMP wchar_t* __cdecl _wtempnam (const wchar_t*, const wchar_t*);
_CRTIMP int __cdecl _wrename (const wchar_t*, const wchar_t*);
_CRTIMP int __cdecl _wremove (const wchar_t*);
_CRTIMP void __cdecl _wperror (const wchar_t*);
_CRTIMP FILE* __cdecl _wpopen (const wchar_t*, const wchar_t*);
#endif
#ifndef __NO_ISOCEXT
int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...);
__CRT_INLINE int __cdecl
vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
{ return _vsnwprintf ( s, n, format, arg);}
int __cdecl vwscanf (const wchar_t * __restrict__, __VALIST);
int __cdecl vfwscanf (FILE * __restrict__,
const wchar_t * __restrict__, __VALIST);
int __cdecl vswscanf (const wchar_t * __restrict__,
const wchar_t * __restrict__, __VALIST);
#endif
#define _WSTDIO_DEFINED
#endif
#ifndef __STRICT_ANSI__
#ifdef __MSVCRT__
#ifndef NO_OLDNAMES
_CRTIMP FILE* __cdecl wpopen (const wchar_t*, const wchar_t*);
#endif
#endif

_CRTIMP wint_t __cdecl _fgetwchar (void);
_CRTIMP wint_t __cdecl _fputwchar (wint_t);
_CRTIMP int __cdecl _getw (FILE*);
_CRTIMP int __cdecl _putw (int, FILE*);
#ifndef _NO_OLDNAMES
_CRTIMP wint_t __cdecl fgetwchar (void);
_CRTIMP wint_t __cdecl fputwchar (wint_t);
_CRTIMP int __cdecl getw (FILE*);
_CRTIMP int __cdecl putw (int, FILE*);
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com