mercredi 20 juin 2018

Ouputting String Literal from a variable

I want to know if it is possible to output a raw string from a preset variable. For example:

string test = "test\ntest2";
cout << test;

would output

test
test2

Is it possible to run similar code as above but change the cout statement to print the raw string like so:

test\ntest2

The test variable in my case is set as is and I cannot use R to make a raw string like so:

string test = R"(test\ntest2)";

Aucun commentaire:

Enregistrer un commentaire