Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add error checking to dumpvbi.c
  • Loading branch information
ali1234 committed Feb 23, 2012
1 parent d5a5f2b commit b2af16f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions dumpvbi.c
Expand Up @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) {
int fd;
FILE *f;
char vbi_name[] = "/dev/vbi0";
int c, n;
int c, n, err=0;
char filename[20];

u8 rawbuf[0x10000]; /* 2048*32 */
Expand All @@ -91,13 +91,17 @@ int main(int argc, char *argv[]) {
for(c = 0; ; c++) {
n = read(fd, rawbuf, 0x10000);

sprintf(filename, "%08d.vbi", c);
if (n != 0x10000) err++;
else {
sprintf(filename, "%08d.vbi", c);

f = fopen(filename, "w");
fwrite(rawbuf, n, 1, f);
fclose(f);
f = fopen(filename, "w");
fwrite(rawbuf, n, 1, f);
fclose(f);

printf("%s\r", filename);
if ((c&0x1f)==0)
printf("%s - %d\r", filename, err);
}
}

err_query:
Expand Down

0 comments on commit b2af16f

Please sign in to comment.