#include main() { FILE *fptr1; FILE *fptr2; long i, fs, fsm; char c; char fname[256]; fptr1 = fopen("/dev/r50", "r"); if (fptr1 == NULL) { printf("Unable to open /dev/r50\n"); exit(1); } /* fs contains file size in bytes */ fs = 0; fsm = 1000000000; for(i=0; i<10; i++) { c = getc(fptr1); fs = fs + ((long)c - 48) * fsm; fsm = fsm / 10; } /* skip separator */ getc(fptr1); /* get file name */ i = 0; c = getc(fptr1); while(c != 0xa) { fname[i++] = c; c = getc(fptr1); } fname[i] = 0; printf("Extracting %s (%ld bytes)\n", fname, fs); /* open output file */ fptr2 = fopen(fname, "w"); if (fptr2 == NULL) { printf("Unable to open %s\n", fname); exit(1); } for(i=0; i