📄 stdio.h
字号:
/* Define ISO C stdio on top of C++ iostreams. Copyright (C) 1991, 1994-1999, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *//* * ISO C99 Standard: 7.19 Input/output <stdio.h> */#ifndef _STDIO_H#if !defined __need_FILE && !defined __need___FILE# define _STDIO_H 1# include <features.h>__BEGIN_DECLS# define __need_size_t# define __need_NULL# include <stddef.h># include <bits/types.h># define __need_FILE# define __need___FILE#endif /* Don't need FILE. */#if !defined __FILE_defined && defined __need_FILE/* The opaque type of streams. This is the definition used elsewhere. */typedef struct _IO_FILE FILE;# define __FILE_defined 1#endif /* FILE not defined. */#undef __need_FILE#if !defined ____FILE_defined && defined __need___FILE/* The opaque type of streams. This is the definition used elsewhere. */typedef struct _IO_FILE __FILE;# define ____FILE_defined 1#endif /* __FILE not defined. */#undef __need___FILE#ifdef _STDIO_H#define _STDIO_USES_IOSTREAM#include <libio.h>#ifdef __USE_XOPEN# ifdef __GNUC__# ifndef _VA_LIST_DEFINEDtypedef _G_va_list va_list;# define _VA_LIST_DEFINED# endif# else# include <stdarg.h># endif#endif/* The type of the second argument to `fgetpos' and `fsetpos'. */#ifndef __USE_FILE_OFFSET64typedef _G_fpos_t fpos_t;#elsetypedef _G_fpos64_t fpos_t;#endif#ifdef __USE_LARGEFILE64typedef _G_fpos64_t fpos64_t;#endif/* The possibilities for the third argument to `setvbuf'. */#define _IOFBF 0 /* Fully buffered. */#define _IOLBF 1 /* Line buffered. */#define _IONBF 2 /* No buffering. *//* Default buffer size. */#ifndef BUFSIZ# define BUFSIZ _IO_BUFSIZ#endif/* End of file character. Some things throughout the library rely on this being -1. */#ifndef EOF# define EOF (-1)#endif/* The possibilities for the third argument to `fseek'. These values should not be changed. */#define SEEK_SET 0 /* Seek from beginning of file. */#define SEEK_CUR 1 /* Seek from current position. */#define SEEK_END 2 /* Seek from end of file. */#if defined __USE_SVID || defined __USE_XOPEN/* Default path prefix for `tempnam' and `tmpnam'. */# define P_tmpdir "/tmp"#endif/* Get the values: L_tmpnam How long an array of chars must be to be passed to `tmpnam'. TMP_MAX The minimum number of unique filenames generated by tmpnam (and tempnam when it uses tmpnam's name space), or tempnam (the two are separate). L_ctermid How long an array to pass to `ctermid'. L_cuserid How long an array to pass to `cuserid'. FOPEN_MAX Minimum number of files that can be open at once. FILENAME_MAX Maximum length of a filename. */#include <bits/stdio_lim.h>/* Standard streams. */extern FILE *stdin; /* Standard input stream. */extern FILE *stdout; /* Standard output stream. */extern FILE *stderr; /* Standard error output stream. */#ifdef __STDC__/* C89/C99 say they're macros. Make them happy. */#define stdin stdin#define stdout stdout#define stderr stderr#endif/* Remove file FILENAME. */extern int remove (__const char *__filename) __THROW;/* Rename file OLD to NEW. */extern int rename (__const char *__old, __const char *__new) __THROW;/* Create a temporary file and open it read/write. */#ifndef __USE_FILE_OFFSET64extern FILE *tmpfile (void) __THROW;#else# ifdef __REDIRECTextern FILE *__REDIRECT (tmpfile, (void) __THROW, tmpfile64);# else# define tmpfile tmpfile64# endif#endif#ifdef __USE_LARGEFILE64extern FILE *tmpfile64 (void) __THROW;#endif/* Generate a temporary filename. */extern char *tmpnam (char *__s) __THROW;#ifdef __USE_MISC/* This is the reentrant variant of `tmpnam'. The only difference is that it does not allow S to be NULL. */extern char *tmpnam_r (char *__s) __THROW;#endif#if defined __USE_SVID || defined __USE_XOPEN/* Generate a unique temporary filename using up to five characters of PFX if it is not NULL. The directory to put this file in is searched for as follows: First the environment variable "TMPDIR" is checked. If it contains the name of a writable directory, that directory is used. If not and if DIR is not NULL, that value is checked. If that fails, P_tmpdir is tried and finally "/tmp". The storage for the filename is allocated by `malloc'. */extern char *tempnam (__const char *__dir, __const char *__pfx) __THROW __attribute_malloc__;#endif/* Close STREAM. */extern int fclose (FILE *__stream) __THROW;/* Flush STREAM, or all streams if STREAM is NULL. */extern int fflush (FILE *__stream) __THROW;#ifdef __USE_MISC/* Faster versions when locking is not required. */extern int fflush_unlocked (FILE *__stream) __THROW;#endif#ifdef __USE_GNU/* Close all streams. */extern int fcloseall (void) __THROW;#endif#ifndef __USE_FILE_OFFSET64/* Open a file and create a new stream for it. */extern FILE *fopen (__const char *__restrict __filename, __const char *__restrict __modes) __THROW;/* Open a file, replacing an existing stream with it. */extern FILE *freopen (__const char *__restrict __filename, __const char *__restrict __modes, FILE *__restrict __stream) __THROW;#else# ifdef __REDIRECTextern FILE *__REDIRECT (fopen, (__const char *__restrict __filename, __const char *__restrict __modes) __THROW, fopen64);extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename, __const char *__restrict __modes, FILE *__restrict __stream) __THROW, freopen64);# else# define fopen fopen64# define freopen freopen64# endif#endif#ifdef __USE_LARGEFILE64extern FILE *fopen64 (__const char *__restrict __filename, __const char *__restrict __modes) __THROW;extern FILE *freopen64 (__const char *__restrict __filename, __const char *__restrict __modes, FILE *__restrict __stream) __THROW;#endif#ifdef __USE_POSIX/* Create a new stream that refers to an existing system file descriptor. */extern FILE *fdopen (int __fd, __const char *__modes) __THROW;#endif#ifdef __USE_GNU/* Create a new stream that refers to the given magic cookie, and uses the given functions for input and output. */extern FILE *fopencookie (void *__restrict __magic_cookie, __const char *__restrict __modes, _IO_cookie_io_functions_t __io_funcs) __THROW;/* Create a new stream that refers to a memory buffer. */extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;/* Open a stream that writes into a malloc'd buffer that is expanded as necessary. *BUFLOC and *SIZELOC are updated with the buffer's location and the number of characters written on fflush or fclose. */extern FILE *open_memstream (char **__restrict __bufloc, size_t *__restrict __sizeloc) __THROW;#endif/* If BUF is NULL, make STREAM unbuffered. Else make it use buffer BUF, of size BUFSIZ. */extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;/* Make STREAM use buffering mode MODE. If BUF is not NULL, use N bytes of it for buffering; else allocate an internal buffer N bytes long. */extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, int __modes, size_t __n) __THROW;#ifdef __USE_BSD/* If BUF is NULL, make STREAM unbuffered. Else make it use SIZE bytes of BUF for buffering. */extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, size_t __size) __THROW;/* Make STREAM line-buffered. */extern void setlinebuf (FILE *__stream) __THROW;#endif/* Write formatted output to STREAM. */extern int fprintf (FILE *__restrict __stream, __const char *__restrict __format, ...) __THROW;/* Write formatted output to stdout. */extern int printf (__const char *__restrict __format, ...) __THROW;/* Write formatted output to S. */extern int sprintf (char *__restrict __s, __const char *__restrict __format, ...) __THROW;/* Write formatted output to S from argument list ARG. */extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format, _G_va_list __arg) __THROW;/* Write formatted output to stdout from argument list ARG. */extern int vprintf (__const char *__restrict __format, _G_va_list __arg) __THROW;/* Write formatted output to S from argument list ARG. */extern int vsprintf (char *__restrict __s, __const char *__restrict __format, _G_va_list __arg) __THROW;#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98/* Maximum chars of output to write in MAXLEN. */extern int snprintf (char *__restrict __s, size_t __maxlen, __const char *__restrict __format, ...) __THROW __attribute__ ((__format__ (__printf__, 3, 4)));extern int vsnprintf (char *__restrict __s, size_t __maxlen, __const char *__restrict __format, _G_va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 3, 0)));#endif#ifdef __USE_GNU/* Write formatted output to a string dynamically allocated with `malloc'. Store the address of the string in *PTR. */extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f, _G_va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 2, 0)));extern int __asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) __THROW __attribute__ ((__format__ (__printf__, 2, 3)));extern int asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...) __THROW __attribute__ ((__format__ (__printf__, 2, 3)));/* Write formatted output to a file descriptor. */extern int vdprintf (int __fd, __const char *__restrict __fmt, _G_va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -