This preview shows page 1. Sign up to view the full content.
Unformatted text preview: l keeps track of all information about the open ﬁle; the application keeps keep track of only the descriptor. 620 CHAPTER 12. NETWORK PROGRAMMING The kernel maintains a ﬁle position , initially 0, for each open ﬁle. An application can set the current ﬁle position explicitly by performing a seek operation. A read operation copies Ñ ¼ bytes from the ﬁle to memory, starting at the current ﬁle position , and then incrementing by Ñ. A read operation with Ò triggers a condition known as end-of-ﬁle (EOF), which can be detected by the application. Notice that there is no explicit ”EOF character” at the end of a ﬁle. Similarly, a write operation copies Ñ ¼ bytes from memory to a ﬁle, starting at the current ﬁle position , and then updating . When an application is ﬁnished reading and writing the ﬁle, it informs the kernel by asking it to close the ﬁle. The kernel frees the structures it created when the ﬁle was opened and restores the descriptor to a pool of available descriptors. The next ﬁle that is open...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American