C snipt.info - Index - Arhiva

download | new post | afis on April Mon 13th 12:08 AM - Never Expires

  1. #include<fcntl.h>
  2. #include<stdlib.h>
  3. #include<stdio.h>
  4. #include<unistd.h>
  5. #include<sys/types.h>
  6. #include<sys/stat.h>
  7.  
  8. int main(int argc, char* argv[])
  9. {
  10. int nr, i, df;
  11. if (argc<2)
  12. {
  13.     exit(2);
  14. }
  15. df=open(argv[1],O_RDONLY);
  16. if(df==-1)
  17. {
  18.     exit(1);
  19. }
  20. for(i=1;i<=20;i++)
  21. {
  22.     read(df,&nr, sizeof(int));
  23.     printf("%d ",nr);
  24. }
  25.     printf("\n");
  26.  
  27. return 0;
  28. }

Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
Syntax Highlighting:
To highlight particular lines, prefix each line with @@
Pressing TAB inserts 3 spaces