Hi
I call CreateFile() in my program and write to it when receiving data. But sometime there could be errors in receiving data, and my program quits. But I found the empty file has been created in the location, and sometime I have problem to remove it - it throws "sharing violation error". How can I not to create the file unless I receive valid data
Here is how I call CreateFile()
HANDLE hFile = INVALID_HANDLE_VALUE
hFile = CreateFileA( sName
GENERIC_WRITE
0
NULL
OPEN_ALWAYS
FILE_FLAG_SEQUENTIAL_SCAN
0 )
if( hFile == INVALID_HANDLE_VALUE
//throw CCException( CWin32err(), GetLastError(), _T("Falied to create file") )
return CREATE_NFILE_ERR
..
Thanks
Peter