#define a string in multiple lines?
I hope there's an easy way to do this. I have a long string spanning multiple lines. I just want to write that to a file in a function. I'm wondering if there is a way to make a #define that lets the string span multiple lines?
Or is there a better approach to this? There's a whole bunch of invalid characters in it too and it's a pain to remove them one by one.
Re: #define a string in multiple lines?
If your line ends with an underscore, it will be carried over to the next line. I'm not sure if this will work inside a string constant, but it's worth a shot!
Code:
#define foo() this is a; _
multiple line; _
definition;
Edit: wrong character. Use the backslash (\) instead.
Re: #define a string in multiple lines?
aah my friend just showed me to use \ at the end
what's the difference between usign that and _
Re: #define a string in multiple lines?
The _ is the VB way, and sunburnt either made a typo or confused the two. It won't work in C++, at least not standard C++.
Re: #define a string in multiple lines?
Quote:
Originally Posted by CornedBee
The _ is the VB way, and sunburnt either made a typo or confused the two. It won't work in C++, at least not standard C++.
Whoops, you're right -- teaches me to post late at night :blush: I meant to use the backslash character!
Re: #define a string in multiple lines?