6 static void Abort (const char *fmt,...)
10 vfprintf (stderr, fmt, args);
15 int main (int argc, char **argv)
18 FILE *outFile = stdout;
19 time_t now = time (NULL);
23 Abort ("Usage: %s bin-file [> result]", argv[0]);
25 if ((inFile = fopen(argv[1],"rb")) == NULL)
26 Abort ("Cannot open %s\n", argv[1]);
29 "/* data statements for file %s at %.24s */\n"
30 "/* Generated by BIN2C, G. Vanem 1995 */\n",
31 argv[1], ctime(&now));
34 while ((ch = fgetc(inFile)) != EOF)
37 fputs ("\n ", outFile);
38 fprintf (outFile, "0x%02X,", ch);
40 fputc ('\n', outFile);