Review: data Transfer DAn application uses read to transfer data from a file into memory, and use write to transfer data from memory to a file D For example, n=readlfdesc, buf, 24) D Both read and write begin transfer at the current file position, and both operations update the file position when they finish 18
18 Review: Data Transfer An application uses read to transfer data from a file into memory, and use write to transfer data from memory to a file For example, n = read(fdesc, buf, 24) Both read and write begin transfer at the current file position, and both operations update the file position when they finish
Review: data Transfer DIf an application attempts to read more bytes than the file contains, the read unction extracts as many bytes as the file contains and returns the number read as its result DIf the file is positioned at the end of a file when an application calls read, the read call returns zero to indicate an end-of-file condition
19 Review: Data Transfer If an application attempts to read more bytes than the file contains, the read function extracts as many bytes as the file contains and returns the number read as its result If the file is positioned at the end of a file when an application calls read, the read call returns zero to indicate an end-of-file condition
Review permission to search a Dictionary DUNIX SyStems organize files into a hierarchy using directories to hold files and other directories )The directory permissions(the same 9-bit protection bit) only specify which operations are allowed on the directory itself
20 Review: Permission to Search a Dictionary UNIX systems organize files into a hierarchy using directories to hold files and other directories The directory permissions (the same 9-bit protection bit) only specify which operations are allowed on the directory itself
Review permission to search a dictionary DUNIX interprets the execute permi bits for directories to mean search ssion persson If an application has search permission, it can reference a file that lies in a director Search permission can be used to hide or uncover an entire subtree of the file directory without modifying the permissions on individual files in the subtree
21 Review: Permission to Search a Dictionary UNIX interprets the execute permission bits for directories to mean search permission If an application has search permission, it can reference a file that lies in a directory Search permission can be used to hide or uncover an entire subtree of the file directory without modifying the permissions on individual files in the subtree
Review random access O After a file has been opened, the position can be changed by calling function lseek D Lseek takes three arguments that specify a file descriptor, an offset, and a measure for the offset lseek(fdes, 100L L Set D The current position of the file with descriptor fdes should be moved to byte number 100
22 Review: Random Access After a file has been opened, the position can be changed by calling function lseek Lseek takes three arguments that specify a file descriptor, an offset, and a measure for the offset: lseek(fdesc, 100L, L_SET) The current position of the file with descriptor fdesc should be moved to byte number 100