分类:
2008-10-15 00:23:56
1.4 Files and Directories
Working Directory
Every process has a working directory, sometimes called the current working directory. This is the directory from which all relative pathnames are interpreted. A process can change its working directory with the chdir function
1.5 input and output
Buffered i/o function以及 unbuffered i/o function的区别,后者是系统调用read/write,并不是他们没有缓冲,其实在系统内和中,他们也是有缓冲的。buffered i/o是指标准库中的 i/o function,他们调用系统调用,即调用unbuffered i/o,并且自己使用自己生成的对用户透明的缓冲区,库是运行在用户空间的,该缓冲也是在用户空间的。据个例子,fgets调用read来读取文件,fgets就是标准库函数,是buffered i/o function,在运行的时候,他会一次性让read多读取一些数据到缓冲中,当下次调用fgets的时候就不用再调用系统调用read了。写操作也是这样。所以就说:使用buffered i/o编程,比直接使用unbuffered i/o要效率高。