The prolific way of printing documentation for hacky programs is generally:
void print_help(){
printf("a whole bunch of information
generally spanning many lines and looking ugly
requires editing a c file to modify documentation");
}
This is ugly IMO, and doesn't make it easy to modify the documentation. The alternatives:
generally dismissive:
void print_help(){
printf("read the README, you idiot");
}
error prone, complex:
void print_help(){
fopen("readme.md", "r");
//error check;
while (read from file){
printf("%s", line);
}
}
I'd like to bridge the gap between solutions 1 and 3, namely:
void print_help(){
printf("#include"help_file.txt"");
}
I guess my questions would be:
- is it really this simple? Does the preprocessor jump over strings, or will it notice the include directive?
- Potential issues? I know anything that won't printf nicely will cause issues if it's put in the files