WCHAR strTest[MAX_PATH];
CString strInfo; FILE* pFile = NULL;
strFileName = "TEST.BIN";
int iRet = fopen_s( &pFile, strFileName, "w+,ccs=UTF-8" );
if( 0 != iRet )
{
return;
}
int k = 0;
for( int i = 1001; i <= 1051; i++ )
{
// #define SEPARATOR 0x1B 这个是.h里面定义的
wmemset( strTest, SEPARATOR, MAX_PATH );
GetDlgItemText( i, strInfo );
wmemcpy( strTest, strInfo, strInfo.GetLength() );
int j = strInfo.GetLength();
if ( i < 1051 )
{
j++;
k = fwrite( strTest, 1, j, pFile );
}
else
{
k = fwrite( strTest, 1, j, pFile );
}
}
fputws( L"\n", pFile ); fclose(pFile);