@nospam: "To create help output (the response to "myprog help", for example) I
currently create a big .h file, which includes a single string, such
as:
static char *help_text = "\
myprog: my program\n\
loads          and\n\
loads           of\n\
painfully manually\n\
formatted      and\n\
justified     text\n"
There's got to be a better way to do this - any ideas? Ideally, I
would like to write the help as a plain text file. Of course, I don't
want to distribute this file with the program, so it needs some
preprocessing. I'm on Linux.
Cheers
Richard"
    @kbuchegg: "<quote>
What is hindering you?
Writing tools is something a programmer is always aware of.
In your case a tool would be simple. Write a program which generates
the header file from a text file:
  open help text file for input
  open header file for output
  output "static char *help_text = \"\\" to header file
  as long as a line could be read from the help text file
    output that line to the header file
    output "\n\\" to the header file
  output "\";" to the header file
  close header file
  close text file
That's your tool.
You edit your plain vanilla help text file. When you are finished
you let the tool generate the header file and use that in the
compilation as usual.
Karl Heinz Buchegger
<email_address>"
    @brusch_removetheunderlinesandthetextbetween_4: "How much time need you to format the text in your editor?
How much time will it need to create a tool?
How much time you will need to search this tool?
The normal help-screen message should fit into one screen page.
Write the text.
Insert " at the start of each line.
Append \n" at the end of each line.
Use the search-and-replace feature of your favourite editor for this.
char const helpmsg[] =
"this\n"
"    is\n"
"        the\n"
"          easy\n"
"             way"
;
st888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4cout << helpmsg << st888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4endl;
Done.
-mb"
    @malcolm: ""Richard Tierney" <email_address> wrote
<quote>
There's no one easy answer. Many C compilers will allow you to embed data
such as strings, images, sound files and so on into the program. However
this means that the listing is no longer portable.
Another way is to write a function that wraps and left-justifies your
string. This is probably the best solution, so long as you have a monospaced
font. With a variable pitched font, the function is still possible to write,
but much more difficult, much less generally useful, and probably more
trouble than it is worth.
The third approach is to write your own utility program to convert a text
file into C source (C data, not executable code). The problem with this is
that the utility program becomes part of you developement environment, may
have to be documented and so on, and the program becomes much more difficult
to maintain."
{'source': 'USENET', 'other_information': '{"reply_count": 3, "forum_name": "comp.lang.c++.20140712.mbox"}', 'file': 'data/output/usenet-comp.lang.parquet'}