使用Unicode字符集
当WriteFile键入\r\n的时候,会有多余的一个空格出来
这个空格应该是一个-t的制表符
我自定义了一个文件格式ded,但是用txt打开
代码:
HANDLE hFile = ::CreateFile(wchFilePath, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD dwSize = 0;
WORD wUnicode = 0xfeff;
wchar_t wchMPtitle[] = _T("[MemoryPool]\r\n");
wchar_t wchMPdefault[] = _T("MemoryPool=MemoryConfigDefault\r\n");
wchar_t wchMPdefaulttitle[] = _T("[MemoryConfigDefault]\r\n");
wchar_t wchMPidynccount[] = _T("iDyncCount=10\r\n");
wchar_t wchMPsubmemheadsize[] = _T("iSubMemHeadSize=128");
::WriteFile(hFile, &wUnicode, sizeof(wUnicode), &dwSize, NULL);
::WriteFile(hFile, wchMPtitle, sizeof(wchMPtitle), &dwSize, NULL);
::WriteFile(hFile, wchMPdefault, sizeof(wchMPdefault), &dwSize, NULL);
::WriteFile(hFile, wchMPdefaulttitle, sizeof(wchMPdefaulttitle), &dwSize, NULL);
::WriteFile(hFile, wchMPidynccount, sizeof(wchMPidynccount), &dwSize, NULL);
::WriteFile(hFile, wchMPsubmemheadsize, sizeof(wchMPsubmemheadsize), &dwSize, NULL);
输出结果:
[MemoryPool]
MemoryPool=MemoryConfigDefault
[MemoryConfigDefault]
iDyncCount=10
iSubMemHeadSize=128
问题是如何才能去掉那个制表符呢?