Stream:ProgramAn abstraction between a member and a physical device. Text streams (character conversion may occur, for example, '/N' to'/n/R') and binary streams.
Files: physical devices, such as disk files, terminals, and printers.
All the streams are the same, but the files are not. The open flow operation is linked to a file.
File stream Io
1. open:
Fopen: open the file and return the stream related to the file. Text and binary. Read, write (generate, clear), attach, read/write (cache should be cleared between read/write)
Freopen: Associate an existing stream with a file.
2. input:
Fgetc and GETC: EOF at the end of the text, and feof () at the end of the binary ().
Fgets: ends with a line break or a specified number. A null character is added at the end of each read.
Fread: Read the specified number to the array.
Fscanf: formatted and read.
3. Output:
Fputc
Fputs and putc: write strings to files and discard null characters.
Fwrite
Fprintf
4. addressing:
Fseek: binary file, specified in bytes.
Fsetpos/fgetpos: Specifies the position, type: fpos_t.
Ftell: the number of bytes from the current position starting from the file.
Rewind: reset the file location pointer to the beginning of the file.
5. close:
Flose: close the file.
6. ungetc: returns a character to the current position of the file stream, which is the first character to be read next time.
Standard stream io1. input:
Getchar:
Gets:
Scanf:
2. Output:
Putchar:
Puts:
Printf: stdin and stdout are predefined file * streams, indicating standard input and output streams.
String Io
Sprintf
Snprintf
Sscanf
Buffer operation:
Fflush
Setbuf
Setvbuf
File Operations:
Remove:
Rename:
Tmpfile
Tmpnam