WriteFile is for write to file and ReadFile is for read from file see CString WriteToFile; HANDLE hFile; DWORD dwRead; WriteToFile="This is a test"; hFile=CreateFile((LPCTSTR)"c:\\test.txt",GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); DWORD m_dwSize=WriteToFile.GetLength(); BOOL bResult=WriteFile(hFile,(LPCTSTR)WriteToFile,m_dwSize,&dwRead,NULL); CloseHandle(hFile); CString strRead=""; DWORD dwReads=0; hFile=CreateFile((LPCTSTR)"c:\\test.txt",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); DWORD dwBufferSize=GetFileSize(hFile,NULL); bResult=ReadFile(hFile,strRead.GetBuffer(dwBufferSize),dwBufferSize,&dwReads,NULL); MessageBox(strRead); CloseHandle(hFile); /*LPTSTR lpt33; lpt33=(LPTSTR)LocalAlloc(LPTR,dwBufferSize); LocalFree(lpt33);*/ And see MSDN_**
**_
whitesky