我有以下代码,我正在尝试将整数更改为 wstring,然后我可以将其传递给文本文件。但问题是当它到达 _itow_s(vec, img_stamp, 10); 将其更改为负数。任何机构都知道是什么问题?
wchar_t img_stamp[64];
while(c<_timeStamp.size()){
vec=_timeStamp.at(c);
_itow_s(vec, img_stamp, 10);
_data +=std::wstring(img_stamp);
_data +=std::wstring(L"\r\n");
c++;
}
HANDLE hFile;
DWORD wmWritten;
hFile = CreateFile( "D:\\test\\testing.txt" ,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile!=NULL){
DWORD len=sizeof(_data);
WriteFile(hFile, _data.c_str(), _data.size() * 2, &wmWritten, NULL);
}
CloseHandle(hFile);