I don't mean that I want space around it, I mean that I want it to include whatever spaces, tabs, etc I happen to have on the edge rather than trimming them off.
Unless you put the whitespace in double quotes, it'll get automatically trimmed.
You could do this (I know it's not ideal):
1 2 3 4 5 6 7 8
#define EXACTLY(A,B,C) A#B C
int main()
{
cout << "\"" << EXACTLY(" ",this is a test," ") << "\"" << endl;
cin.sync();
cin.ignore();
}
Or you could make macros for SPACESn(dummy) and TABSn(dummy) (might need to hard-code this or use boost's preprocessor library), and do something like this:
cout << "\""<<SPACES1()TABS3()"this is a test"TABS2()SPACES4()TABS2()<<"\""<< endl;
Well, I have a macro in the SDK I use that takes for letters and makes them into a long ID: #define MAKEID(a,b,c,d) ((#@a<<24)|(#@b<<16)|(#@c<<8)|(#@d))
I don't fully understand what the @ does (I think it takes it as a character literal instead of a string literal), but my point is that it doesn't work with spaces, tabs, etc. It works perfectly for all other characters. I could assign a numerical ID myself but I was just curious...well, problem solved: it's not possible :)