您的位置:首页 > 运维架构 > Linux

Begining Linux Programing Chapter 3

2012-10-11 10:04 253 查看
/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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息