2 ** Extract a range of bytes from a file.
6 ** extract FILENAME OFFSET AMOUNT
8 ** The bytes are written to standard output.
13 int main(int argc
, char **argv
){
21 fprintf(stderr
, "Usage: %s FILENAME OFFSET AMOUNT\n", *argv
);
24 f
= fopen(argv
[1], "rb");
26 fprintf(stderr
, "cannot open \"%s\"\n", argv
[1]);
33 fprintf(stderr
, "out of memory\n");
36 fseek(f
, ofst
, SEEK_SET
);
37 got
= fread(zBuf
, 1, n
, f
);
40 fprintf(stderr
, "got only %d of %d bytes\n", got
, n
);
43 fwrite(zBuf
, 1, n
, stdout
);