20 lines
441 B
C++
Raw Normal View History

#include <stdio.h>
extern const char* foo();
int main(int argc, const char* argv[])
{
2016-07-09 11:21:54 +02:00
if (argc < 3) {
fprintf(stderr, "Must specify output file and symbol prefix!");
return 1;
2016-07-09 11:21:54 +02:00
}
if (FILE* fout = fopen(argv[1], "w")) {
fprintf(fout, "static const char* %s_string = \"%s\";\n", argv[2], foo());
fclose(fout);
2016-07-09 11:21:54 +02:00
} else {
fprintf(stderr, "Could not open output file \"%s\"", argv[1]);
return 1;
2016-07-09 11:21:54 +02:00
}
return 0;
}