Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* l.01 */ int main(){ /*program xc2.c*/
- /* l.02 */ char BUF[6]= {'x','x','x','x','x','\0'};
- /* l.03 */ int fd = open("file.txt",O_RDONLY);
- /* l.04 */ int fd2 = dup(fd);
- /* l.05 */ lseek(fd2, 3, SEEK_SET);
- /* l.06 */ printf("%s\n",BUF);
- /* l.07 */ pread(fd,BUF+1,2,0);
- /* l.08 */ lseek(fd, 1, SEEK_CUR);
- /* l.09 */ printf("%s\n",BUF);
- /* l.10 */ pread(fd,BUF,2,3);
- /* l.11 */ printf("%s\n",BUF);
- /* l.12 */ read(fd,BUF+2,1);
- /* l.13 */ read(fd,BUF+3,2);
- /* l.14 */ printf("%s",BUF); close(fd);
- /* l.15 */ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement