mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
17dc9b5270
Preliminary debug code (debug.c & debug.h) Reworked .ini file code (parseini.c & parseini.h) Size optimizations (fat.asm & fat32.asm) FAT12/16 boot sector now fully understands the FAT (fat.asm) svn path=/trunk/; revision=2049
48 lines
No EOL
718 B
C
48 lines
No EOL
718 B
C
#include <stdio.h>
|
|
|
|
FILE *in;
|
|
FILE *out;
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
unsigned char ch;
|
|
int cnt = 0;
|
|
|
|
if (argc < 4)
|
|
{
|
|
printf("usage: bin2c infile.bin outfile.h array_name\n");
|
|
return -1;
|
|
}
|
|
|
|
if ((in = fopen(argv[1], "rb")) == NULL)
|
|
{
|
|
printf("Couldn't open data file.\n");
|
|
return -1;
|
|
}
|
|
if ((out = fopen(argv[2], "wb")) == NULL)
|
|
{
|
|
printf("Couldn't open output file.\n");
|
|
return -1;
|
|
}
|
|
|
|
fprintf(out, "unsigned char %s[] = {\n", argv[3]);
|
|
|
|
ch = fgetc(in);
|
|
while (!feof(in))
|
|
{
|
|
if (cnt != 0)
|
|
fprintf(out, ", ");
|
|
if (!(cnt % 16))
|
|
fprintf(out, "\n");
|
|
fprintf(out, "0x%02x", (int)ch);
|
|
cnt++;
|
|
ch = fgetc(in);
|
|
}
|
|
|
|
fprintf(out, "\n};");
|
|
|
|
fclose(in);
|
|
fclose(out);
|
|
|
|
return 0;
|
|
} |