File System Operations (cont)
ssize_t read(int FileDesc, void * Buffer, size_t Count)
- attempt to read Count bytes from FileDesc into Buffer
- if "successful", return number of bytes actually read (NRead)
- if currently positioned at end of file, return 0
- if unsuccessful, return -1 and set
errno
- does not check whether Buffer contains enough space
- advances the file offset by NRead
- does not treat
'\n' as special, nor is there EOF
Once a file is open() 'd ...
- the "current position" in the file is maintained as part of the fd entry
- the "current position" is modified by
read() , write() and lseek()
|