Is there anyway to do something like PHP\'s
print << END
yadayadayada
END;
in C++? (multi-line, unescaped, easy-to-cut-and-paste stre
In C++, it's not usually considered code style to put large amounts of data into source code so there isn't a fancy language way to do it.
It is usually more flexible to put the text into an external file (such as a text file), then it isn't bound into the compiled executable.
If you do want the text to be bound into the executable then (depending on your platform) you can often use some form of resource support, or an assembler with an 'incbin' style directive to give name to a data area with the text that you want.
Alternatively, you can use an external utility (such as xxd -i
) to compiler a named C style array from a given input file. The generated file can then be compiled with the rest of the source code.