Deep analysis of the difference and contact between Linux I/O operations and standard I/O operations __linux

Source: Internet
Author: User

file I/o:open creat close Lseek Read Write DUP dup2 sync fsync fcntl IOCTL

All functions are for file descriptors.

All are atomic operations, and this is especially important when sharing files among multiple processes.

int open (const char *pathname,int flag,.../* mode_t mode*/);

Samples:open (Pathname,o_rdwr | O_creat | O_trunc, mode);

int creat (const char *pathname,mode_t mode);

int close (int filedes);

off_t lseek (int filedes, off_t offset, int whence);

ssize_t Read (int filedes, void *buf, size_t nbytes);

ssize_t write (int filedes, const void *buf, size_t nbytes);

standard I/o: FILE,

The standard libraries are all around the stream, (lesson: fflush is a refreshing buffer to let the data in the buffer be read or written).

The only thing I can list now from memory is the file structure, Fopen,fread,fwrite,fclose,fgetc,fputc,fgets,fputs,fflush.

Standard IO is divided into full buffering, row buffering, without buffering.

Full buffering: To fill the buffer before performing IO operation.

Row buffering: The standard library performs IO operations when a newline character is encountered in the input or output.

There are two limit 1 lines for line buffers, and if a row is full, Io is performed even if there are no newline characters.

2 any time, from a stream without buffering, or a row buffer stream to get input data, will cause flushing all buffer flow. "Here, or very misunderstood."

Without buffering: Character input output. Usually standard error stream stderr is also without buffering.

Advanced I/O:

With regard to advanced I/O, there is too much content, non-blocking I/O, record locks, streams,i/o Multiplexing (Select,pselect, poll, Epoll), asynchronous I/O (System V, BSD), READV,WRITEV,READN, Writen. Store mapped I/O, and so on. These are described in Advanced Programming 2 in UNIX systems.




Http://blog.csdn.net/yunsongice


Linux Multimedia

Http://tech.ccidnet.com/art/302/20060927/911605_7.html

http://gstreamer.freedesktop.org/


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.