【发布时间】:2013-06-30 09:26:10
【问题描述】:
是否可以在c++的以下函数中使用字符串变量代替TEXT("\\*.txt")?
StringCchCat (szDir, MAX_PATH, TEXT("\\*.txt"));
示例:
string ext = "\\*.pdf";
StringCchCat (szDir, MAX_PATH, ext);
用 VS C++ 编译时返回错误:
error C2664: 'StringCchCatW': can not convert parameter 3 from 'std :: string' to 'STRSAFE_LPCWSTR'
【问题讨论】:
-
尝试使用
ext.c_str()而不是ext
标签: c++ string string-concatenation