Advertisement
techno-

Untitled

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