全部博文(92)
分类: 嵌入式
2009-09-02 19:47:30
Reference: "Embedded Linux, C-language programming practice"
1. File I / O operations functions
* open function: open file
int open (const char * pathname, int flags)
* close function: close file
* read function: read the file
ssize_t read (int_fd, void * buf, size_t count)
transfer bytes of count number into point buf
* write function: write file
ssize_t write (int fd, const void * buf, size_t count)
write bytes of count number into file(fd) with beginning of point buf in the memory
* lseek Function: File Positioning
off_t lseek (int fildes, off_t offset, int whence);
retuen the current position of reading and writing
* flock function: lock file
int flock (int fd, int operation)
* mmap function and munmap functions: memory-mapped
int munmap (void * start, size_t length)
map the contents of a file into memory, to write or read this memory region is the direct access to to the content of the document.
* create a function: to create a new file
int create (const char * pathname, mode_t mode)
* fcntl function: to change the file attributes which has been opened
int fcntl (int fields, int cmd, int arg)
If success,return the implementation of the new descriptor, otherwise returns -1
2. the function of related file permissions