CString str="abdc\r\n";
CString str2="George\r\n";
DWORD dw = 0;
OVERLAPPED os ;
HANDLE hFile = CreateFile("C:\\test.txt",
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
CREATE_NEW,
FILE_ATTRIBUTE_NORMAL,
NULL );
//hFile obtained from CreateFile() and was not with FILE_FLAG_OVERLAPPED flag
BOOL bDone = WriteFile( hFile, (LPCVOID)str, str.GetLength(), &dw,NULL);
WriteFile( hFile, (LPCVOID)str2, str2.GetLength(), &dw,NULL);
//or
// hFile obtained from CreateFile() and with FILE_FLAG_OVERLAPPED flag
//BOOL bDone = WriteFile( hFile, (LPCVOID)str, str.GetLength(), &dw,&os);
CloseHandle(hFile);