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

字符串是tchar,fStream.write如何写?报错

2013-03-06 
字符串是tchar,fStream.write怎么写?报错啊TCHAR PathTemp[MAX_PATH]。。。。。。。//fStream.write(\\,1) fS

字符串是tchar,fStream.write怎么写?报错啊



TCHAR PathTemp[MAX_PATH];
。。。。。。。
//fStream.write("\",1); 
fStream.write(PathTemp,wcslen(PathTemp)); 
fStream.write("\r\n",2); 


F:\code\3.4\SearchFiles\SearchFiles.cpp(96) : error C2664: 'write' : cannot convert parameter 1 from 'unsigned short [260]' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
执行 cl.exe 时出错.
[解决办法]
FILE *f;
...
_ftprintf(f,_T("%s\n"),PathTemp);

[解决办法]
wfstream?
[解决办法]
reinterpret_cast<const char *>(PathTemp
[解决办法]
With MSVC (and thus the Microsoft STL), a constructor for filestreams is provided which takes a const wchar_t* filename, allowing you to create the stream as:

wchar_t name[] = L"filename.txt";
std::fstream file(name);

热点排行