Rev 3657 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3657 | Rev 3665 | ||
---|---|---|---|
1 | #include<stdio.h> |
1 | #include<stdio.h> |
2 | #include<stdlib.h> |
2 | #include<stdlib.h> |
3 | 3 | ||
4 | int main(int argc,char** argv) |
4 | int main(int argc,char** argv) |
5 | { |
5 | { |
6 | FILE *fi,*fo; |
6 | FILE *fi,*fo; |
7 | int count=0; |
7 | int count=0; |
8 | int ch; |
8 | int ch; |
9 | fi=fopen("image.bin","rb"); |
9 | fi=fopen("image.bin","rb"); |
10 | fo=fopen("image.c","wb"); |
10 | fo=fopen("image.c","wb"); |
11 | fprintf(fo,"char HOSimage[]={\n"); |
11 | fprintf(fo,"char HOSimage[]={\n"); |
12 | if((ch=getc(fi))!=EOF) {fprintf(fo,"0x%02X",ch);count++;} |
12 | if((ch=getc(fi))!=EOF) {fprintf(fo,"0x%02X",ch);count++;} |
13 | while((ch=getc(fi))!=EOF) {fprintf(fo,",0x%02X",ch);count++;} |
13 | while((ch=getc(fi))!=EOF) {fprintf(fo,",0x%02X",ch);count++;} |
14 | fprintf(fo,"};\nint HOSimagesize=%d;\n",count); |
14 | fprintf(fo,"};\nint HOSimagesize=%d;\n",count); |
15 | return EXIT_SUCCESS; |
15 | return EXIT_SUCCESS; |
16 | } |
16 | } |
17 | 17 | ||
18 | 18 |