Verbatim Literals in Managed C++? (like C#'s @"blah")
in C++11, there is raw string literal:
cout<<R"((\"ddd\aa)\n)"<<endl;
cout<<R"delimiter((\"ddd\aa)\n)delimiter"<<endl;
output is:
(\"ddd\aa)\n
(\"ddd\aa)\n
This is not currently possible. Managed C++ string literals have almost the exact same rules as normal C++ strings. The managed C++ spec is in fact just an augmentation of the ANSI C++ standard.
Currently there is no support for C# style literal syntax in C++ (managed or not). You must manually escape every character.
See Section 9.1.3.3 in the C++/CLI spec for more details. (Spec Link)
While not quite as terse as the '@' C# verbatim string literal, the following does compile /Clr:pure, so you can use C++ Raw String Literals for pure MSIL and a similar result:
String^ f = gcnew String(R"(C:\foo\bar.txt)");
Raw string literals can be used in regular C++ also:
char *x = R"(C:\foo\bar.txt)";
Google "msdn C++ String Literals" for more info