OLD | NEW |
1 /* | 1 /* |
2 ** Extract a range of bytes from a file. | 2 ** Extract a range of bytes from a file. |
3 ** | 3 ** |
4 ** Usage: | 4 ** Usage: |
5 ** | 5 ** |
6 ** extract FILENAME OFFSET AMOUNT | 6 ** extract FILENAME OFFSET AMOUNT |
7 ** | 7 ** |
8 ** The bytes are written to standard output. | 8 ** The bytes are written to standard output. |
9 */ | 9 */ |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 26 matching lines...) Expand all Loading... |
37 got = fread(zBuf, 1, n, f); | 37 got = fread(zBuf, 1, n, f); |
38 fclose(f); | 38 fclose(f); |
39 if( got<n ){ | 39 if( got<n ){ |
40 fprintf(stderr, "got only %d of %d bytes\n", got, n); | 40 fprintf(stderr, "got only %d of %d bytes\n", got, n); |
41 return 1; | 41 return 1; |
42 }else{ | 42 }else{ |
43 fwrite(zBuf, 1, n, stdout); | 43 fwrite(zBuf, 1, n, stdout); |
44 } | 44 } |
45 return 0; | 45 return 0; |
46 } | 46 } |
OLD | NEW |