Hi All,
wonder if someone can point out what I am doing wrong.....I am creating
memory mapped files on win2000 using CreateFile and CreateFileMapping
and MapViewOfFile. At the end of the program I figured it would be
nice to clean up these files but when I issued the del <filename> as a
system command (or if I try the DeleteFile function) I get a message
saying that the file is in use by another process.....Is there
something else I must do to release a file that I have set up using
CreateFile and CreateFileMapping and MapViewOfFile???
Any tips greatly appreciated...
//////////////////////////////////////////////////////////////////////////////////////////////
// When the job ends deleted the wait file, the kill file, and any
memory mapped files that //
// have been created by this process.
//
//////////////////////////////////////////////////////////////////////////////////////////////
ptr_WaitFile->Delete() ;
ptr_KillFile->Delete() ;
for (index1 = 0 ; index1 < ws_used_memory_mapped_files ; index1++)
BEGIN_
#if defined (_MSC_VER)
UnmapViewOfFile(ptr_MemMapBuffer_array[index1]) ;
DWORD dw1 = GetLastError();
CloseHandle(ws_HandleForMemMapFile_array[index1]) ;
DWORD dw2 = GetLastError();
#endif
ptr_DimensionTable_File[index1]->Delete() ;
END_