On Feb 10, 5:17 pm, "John Brawley" <jgbraw...@char ter.netwrote:
"John Brawley" <jgbraw...@char ter.netwrote in message
[...]
I'll think about it more but probably take your suggestions
and use doub-quotes around every line. It'll be 'uglier' to
me in the .cpp file, but I'd just as soon do things "the right
way" whenever possible.
I'm curious. Why uglier? Your solution doesn't allow
indentation of any but the first line---using separate string
literals (concatenated by the compiler) does.
Of course, if this is really a more or less large body of text
that you want to maintain as text, the best solution is to do
just that---maintain it as text, in a separate file. If you
still want to have it "compiled into" your program (there are
pros and contras to this), then a simple preprocessor will
convert it to a C style array. Something like:
#! /usr/bin/awk
BEGIN {
print "// Automatically generated file"
print "// DO NOT EDIT"
print ""
print "#include \"helpText.hh\" "
print ""
print "char const helpText[] ="
}
{
print " \"" $0 "\""
}
END {
print ";"
}
Then create (manually) the necessary "helpText.h h" header (which
is just one line), and the work is done.
(FWIW: I'd strongly recommend this. Maintaining text in a
format that has a C++ string literal per line will be a pain,
e.g. anytime one line gets to long, and you have to reformat the
paragraph. Whereas if the file is pure text, and the editor
recognizes it as such, it will do the reformatting for you.)
--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34