1 fwide function attempts to set the direction of a stream (the orientation of a stream determines whether a read-write single-byte or multibyte character)
int fwide (FILE *fp,int mode) wide-directional return positive value, byte-oriented return negative value, 0 for directional return
Directed stream does not change the orientation of the stream
2 The length of the buffer specified in the SETBUF function is bufsiz, and this constant is defined in stdio.h
3 Freopen and Fdopen functions
FILE *freopen (char *pathname,constchar *type,file *FP)
FILE *fdopen (int filedes,constchar *type)
3 gets and fgets, puts, and fputs functions
Char *fgets (char *buf,int n,file *fp)char *gets (char *buf) int fputs (constchar *str,file *fp)int puts (const Char *str)
The Get function cannot specify a buffer length, which may result in storage space after it is written to the buffer
The puts function adds a line break
42 Binary I/O
size_t fread (void *buf,size_t size,size_t n,file *fp) size_t fwrite (constvoid *ptr , size_t size,size_t n,file *FP)
5 Locating the Stream
The position in the stream can be represented by a long, off_t, and fpos_t three types, corresponding to three kinds of functions for locating and setting the current position of the stream.
Long
long ftell (file *fp)int fseek (file *fp,long offset,int whence)
off_t:
off_t Ftell (FIEL *fp)int fseeko (FILE *fp,off_t offset,int whence)
pos_t:
int fgetpos (file *fp,fpos_t *POS)int fsetpos (file *fp,const fpos_t *pos)
6 Formatting I/O
Formatted output: printf, fprintf, sprintf, snprintf (can specify buffer length n compared to sprintf, overflow over length)
vprintf, vfprintf, vsprintf, vsnprintf
Formatted input: scanf, fscanf, sscanf
VSCANF, VFSCANF, vsscanf
5th Chapter Standard I/O Library summary