首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

MFC CString Replace函数解决方法

2012-04-24 
MFC CString Replace函数我希望把 c:\a\b\c\aa.txt字符串转变成C:\\a\\b\\c\\aa.txt用CString的Replace函

MFC CString Replace函数
我希望把 c:\a\b\c\aa.txt 字符串转变成 C:\\a\\b\\c\\aa.txt
用CString的Replace函数
int n = ss.Replace(L"\",L"\\");
但是编译的时候出现了很多错误
1>f:\毕业设计\test5\test5\readdata.cpp(24) : error C2017: illegal escape sequence
1>f:\毕业设计\test5\test5\readdata.cpp(24) : error C2017: illegal escape sequence
1>f:\毕业设计\test5\test5\readdata.cpp(24) : error C2001: newline in constant
1>f:\毕业设计\test5\test5\readdata.cpp(24) : error C2308: concatenating mismatched strings
1> Concatenating wide "",L" with narrow ");"

应该怎么改正?错误在哪里?

[解决办法]
int n = ss.Replace(L"\\",L"\\\\");

[解决办法]

C/C++ code
int n = ss.Replace(L"\\",L"\\\\");
[解决办法]
探讨
int n = ss.Replace(L"\\",L"\\\\");

热点排行