Begining Linux Programing Chapter 3

来源:互联网 发布:闲鱼卖家如何淘宝介入 编辑:程序博客网 时间:2024/05/19 04:02
/dev/console  
Error messages and diagnostics are often sent to this device.
/dev/tty
It is an alias for the controlling terminal of a process.
/dev/null
All output written to this device is discarded.
Library Functions:
The library functions arrange for the low-level system calls .
Permission:
The mode value given in the open call is ANDed with the inverse of the user mask value at runtime.
ioctl:
It provides an interface for controlling the behavior of devices and their descriptors and configuring underlying services.
The standard I/O library:
The equivalent of the low-level file descriptor is called a stream is implemnted as a pointer to a structure, a FILE *.
Three file streams are automatically opened when a program is strarted.They are stdin,stdout,stderr.
fclose:
To close the specified stream,causing any unwritten data to be fgwritten.When a program ends normally,fclose is called automatically on all file streams that are still open.
fflush:
causing all outstanding data on a file stream to be  written immediately. f
fgets:
read a string from an input file stream.
Streams Error:
The ferror function tests the error indicator for a stream and returns nonzero if it's set,but zero otherwise.
The feof function tests the end-of-file indicator within a stream and returns nonzero if it is set,zero otherwise.
The clearerr function clears the end-of-file and error indicators for the stream to which stream points.
Error:
strerror,maps an error number into a string describing the type of error that has occurred.
perror,report in errno,into a string and prints it on the standard error stream.
原创粉丝点击