File output spaces behind the characters?

Category: C/C++ -> C++ Author: kknd1231 Date: 2007-01-27 19:49:36
 
kknd1231
2007-01-27 19:49:36
With wfopen () outputs a space behind the characters? If this should be the actual output abc but output a b c. Project configuration is: is the UNICODE character set; static library in use MFC; dynamic link to the ATL. I think it is not the MFC CString problem? There are ways to convert it works without changing the configuration of the case?
jetcoyuan
2007-01-27 20:04:10
you use a binary editor to open to see to know. Do not use Notepad to open.
nav280361
2007-01-27 20:15:16
1 wide characters occupy two bytes

.
pangjingluhai
2007-01-27 20:32:34

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;

//   MFC 
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: 
_tprintf(_T(" : MFC  \n"));
nRetCode = 1;
}
else
{
// TODO:  。
FILE* pFile;
CString str=_T("efg ");
pFile = _wfopen(L" .txt", L"a");
{
//fwrite(L"abdc !", 2, 7, pFile);
fwrite(str.GetBuffer(), 2, str.GetLength(), pFile);
}
}

return nRetCode;
}

I try reproduce the error, but the output of the code above is the correct format.
cfy_bigox
2007-01-27 20:39:58

late today, tomorrow, and then the whole! ! ! !
jxl080905
2007-01-27 20:55:01
find a way to convert with WideCharToMultiByte (). You can CString wide character to multibyte.