tailieunhanh - Lập trình Linux IO
Các hướng dẫn sau đây mô tả khác nhau phổ biến phương pháp để đọc và ghi các tập tin và thư mục trên một hệ thống Unix. Một phần của thông tin được phổ biến kiến thức C, và được lặp lại ở đây cho đầy đủ | Linux I/O Programming TMA Training Center (TTC) 1. Objective 2. Unix file system 3. Standard I/O Library - Opening file - Closing file - Reading file - Writing file - Seeking file 4. Check user's permissions for a file 5. Get file’s status 6. Change permissions of a file 7. Reading The Contents Of Directories Contents The following tutorial describes various common methods for reading and writing files and directories on a Unix system. Part of the information is common C knowledge, and is repeated here for completeness Objectives Files are stored in the filesystem in two pieces: (1) a chunk of data somewhere in the filesystem; (2) a data structure which contains: location, size, creation/modification/access times, ownership, access attributes of and links to the file. This data structure is called an "inode.“ The only thing about the file not included in the inode is the name of the file Unix File System Unix INODE Structure One of the unique things about Unix as an operating system is that regards everything as a file. Files can be divided into four categories Ordinary or plain files Directories Special or device files. Links Everything is a File Ordinary files Ordinary files can contain text, data, or program information. An ordinary file cannot contain another file, or directory. An ordinary file can be thought of as a one-dimensional array of bytes. Directories In a previous section, we described directories as containers that can hold files, and other directories. A directory is actually implemented as a file that has one line for each item contained within the directory. Each line in a directory file contains only the name of the item, and a numerical reference to the location of the item. The reference is called an i-number, and is an index to a table known as the i-list. The i-list is a complete list of all the storage space available to the file system. Special files Special files represent input/output (i/o) devices, like a tty (terminal), a disk drive, . | Linux I/O Programming TMA Training Center (TTC) 1. Objective 2. Unix file system 3. Standard I/O Library - Opening file - Closing file - Reading file - Writing file - Seeking file 4. Check user's permissions for a file 5. Get file’s status 6. Change permissions of a file 7. Reading The Contents Of Directories Contents The following tutorial describes various common methods for reading and writing files and directories on a Unix system. Part of the information is common C knowledge, and is repeated here for completeness Objectives Files are stored in the filesystem in two pieces: (1) a chunk of data somewhere in the filesystem; (2) a data structure which contains: location, size, creation/modification/access times, ownership, access attributes of and links to the file. This data structure is called an "inode.“ The only thing about the file not included in the inode is the name of the file Unix File System Unix INODE Structure One of the unique things about Unix as an operating system .
đang nạp các trang xem trước