编程语言
首页 > 编程语言> > C++11新特性

C++11新特性

作者:互联网

//在Windows中(Linux是斜杠,所以不需要转义),我们需要对路径的字符串中反斜杠转义
//不转义
string s = "D:\hello\world\test.txt";
cout<<s<<endl;
//转义
s = "D:\\hello\\world\\test.txt";
cout<<s<<endl;
//原始字面量,其中xxx可以是任意字符串,作用是用来描述的,打印时不会显示,但左右两边必须相同
s = R"xxx(D:\hello\world\test.txt)xxx";
cout<<s<<endl;

标签:11,字面,特性,转义,转义字符,原始,C++,斜杠,字符串
来源: https://www.cnblogs.com/mlmz/p/15843652.html