yes this is true, I was hoping there was a jpeg to array converter or something lol
this way I can load things like jpegs directly intothe binary and load it in a way that I'd like
Printable View
yes this is true, I was hoping there was a jpeg to array converter or something lol
this way I can load things like jpegs directly intothe binary and load it in a way that I'd like
You're writing code, right? So why can't you create such a tool yourself?
Here it is anyway.
Code:/* anything2c.c */
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
FILE *infp;
char *comma = "";
int ch;
int i;
infp = fopen(argv[1], "rb");
if(infp == NULL) exit(1);
printf("unsigned char %s[] = {\n", argv[2]);
while((ch = fgetc(infp)) != EOF)
{
printf("%s 0x%02X", comma, ch);
comma = ",\n";
}
printf("\n};\n");
fclose(infp);
return 0;
}
Well, there's been no mention of Linux, so I still have to ask o_O
Besides... are there not similar systems in other operating systems, as well?
Well, not familiar with XPM formats, so I did not know...
Yes, you are right. The program will be compatible with linux and windows so I want to include the image inside the binary for ease of portability