#include "stdio.h" #include "sys/fcntl.h" #include "stdlib.h" int main(int argc,char* argv[]){ int fd; char buf[10]; int num; if(argc!=2){ printf("filename miss!"); exit(1); } fd=open(argv[1],O_RDONLY); if(fd==-1){ printf("error"); exit(1); } while((num=read(fd,buf,10))!=0) { write(1,buf,num); } close(fd); return 0; }