From: hackbard Date: Thu, 13 Sep 2007 12:09:56 +0000 (+0200) Subject: fixed binary writing X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=605c4e2431910b6b996453272d6d88d57c1a3614;p=my-code%2Farm.git fixed binary writing --- diff --git a/betty/font2b.c b/betty/font2b.c index 6c1af61..fd88252 100644 --- a/betty/font2b.c +++ b/betty/font2b.c @@ -40,7 +40,7 @@ int main(int argc,char **argv) { stat=CHAR; if(argc==2) { - fd=open(argv[1],O_WRONLY); + fd=open(argv[1],O_WRONLY|O_CREAT); if(fd<0) { perror("file open"); return fd; @@ -54,11 +54,13 @@ int main(int argc,char **argv) { for(font=0;font<=0xff;font++) { /* print the font number */ - printf("\t/* %d 0x%02x",font,font); - if((font>0x1f)&(font<0x7f)) - printf(" %c */\n",font); - else - printf(" */\n"); + if(stat==CHAR) { + printf("\t/* %d 0x%02x",font,font); + if((font>0x1f)&(font<0x7f)) + printf(" %c */\n",font); + else + printf(" */\n"); + } /* print the array content of the font */ for(col=0;col<8;col++) {