You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
713 B
44 lines
713 B
<pre>
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int i;
|
|
for(i = 1;i < argc;i++)
|
|
{
|
|
FILE *f = fopen(argv[i], "rb");
|
|
char c;
|
|
struct stat buf;
|
|
|
|
if(!f)
|
|
{
|
|
fprintf(stderr, "Can't open file.\n");
|
|
return 255;
|
|
}
|
|
|
|
int s = 0, sz;
|
|
stat(argv[i], &buf);
|
|
|
|
sz = buf.st_size;
|
|
|
|
printf("%s\nstd::string fmt_codec::fmt_pixmap()\n{\n\treturn std::string(\"", argv[i]);
|
|
|
|
while(s++ < sz-1)
|
|
{
|
|
fread(&c, 1, 1, f);
|
|
printf("%u,", (unsigned char)c);
|
|
}
|
|
|
|
fread(&c, 1, 1, f);
|
|
printf("%u", (unsigned char)c);
|
|
|
|
printf("\");\n}\n\n");
|
|
fclose(f);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
</pre> |