Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. int main(int argc, char * argv[])
  6. {
  7. FILE *fp;
  8. char buffer[(int)argv[4]];
  9. long int start =(int)argv[3];
  10. fp = fopen(argv[2], "w+");
  11. long int bg = (int)0;
  12. int size;
  13. fseek(fp, SEEK_END, bg);
  14. size = (int)ftell(fp);
  15. printf("File Size %d\n", size);
  16. fseek(fp, SEEK_SET, bg);
  17. fseek(fp, SEEK_SET, start);
  18.  
  19. if (((int)argv[3]+(int)argv[4]) > size ){
  20. fread(buffer, (int)(size-(int)argv[4]), 1, fp);
  21. }
  22. else
  23. {
  24. fread(buffer, (int)argv[4], 1, fp);
  25. }
  26.  
  27. fclose(fp);
  28.  
  29. fp = fopen("Rezultatai.dat", "a+");
  30.  
  31. fwrite(buffer, strlen(buffer)+1, 1, fp);
  32.  
  33. fclose(fp);
  34.  
  35. printf("%s\n", buffer);
  36. return 0;
  37.  
  38.  
  39. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement