Most of the UNIX errors return a negative integer or error code, and 0 is the error code.
1. A file descriptor will be returned when each file is opened
2.unix standard input and output error code file descriptors are replaced with constant Stdin_fileno,stdout_fileno,strerr_fileno (in unistd.h file) in 0 1 2,posix.1 respectively
3.Open function Use (do not remember, write more, more practice, just remember, do not understand the manual, too many parameters)
4.NAME_MAX=14, if the file name exceeds this value, it will be truncated automatically, but the BSD system will error (Enametoolong), not only the file directory problem, the call function can also be problematic
The 5.create (pathname,mode) function creates a new file, returns FD successfully, fails-1, or can be created with open, which creates a file in write-only mode.
The 6.close (int fd) function closes a file, but it closes automatically after the process is finished, but it's a matter of habit to write it, or it will be a big problem (Nonblock).
7.lseek function only modifies offset, no I/O operation
(Each process shares the same v node)
About atomic operations:
To put it bluntly is to point at the end of the offset before each file write operation ... Automatic, before it seems to be manually lseek
(Ps: Atomic operation more than this one)
About DUP and dup2:
Fcntl for modifying file flag values
Advanced Programming for the UNIX environment read the third of the notes-file I/O