From 419d650776700eaddc1feb6a175bd8bcec08b1e5 Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 13 Mar 2020 15:12:58 +0000 Subject: Fixes to cfile tools. --- cfile8.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'cfile8.c') diff --git a/cfile8.c b/cfile8.c index 647e1d5..c41878a 100644 --- a/cfile8.c +++ b/cfile8.c @@ -21,7 +21,7 @@ int main(int argc, char *argv[]) { if (!(in=fopen(argv[1],"rb"))) { - perror(argv[0]); + perror(argv[1]); } } @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) { if (!(out=fopen(argv[2],"w"))) { - perror(argv[0]); + perror(argv[2]); } } @@ -54,10 +54,10 @@ int main(int argc, char *argv[]) first=1; len=0; - while(!feof(in)) - { - fread(&num,sizeof num,1,in); + fread(&num,sizeof num,1,in); + while(!feof(in)) + { if (col==0) { if (first) @@ -80,7 +80,9 @@ int main(int argc, char *argv[]) col=(col+1)%8; num=0; len++; - } + + fread(&num,sizeof num,1,in); + } fprintf(out,"\n\t};\n#define %s_LEN %d\n", name, len); -- cgit v1.2.3