1, read write is the most basic and common io operation is the application layer and kernel layer of communication media, how to read, write achieve cat function?
Clear that we are reading the file and then displayed is the output file out Description 2
Is simple to implement main idea is to familiarize yourself with the process
Pseudocode ideas:
#include <stdio.h>
int main(int argc,int argv[])
{
int fd = open (argv [1], O_RDONLY); first file handle to know where to determine a good read
char buf[250];
int ret = read(fd,buf,sizeof(buf));
write(1,buf,ret);
close(fd);
return 0;
}