Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting memory mapped files

Status
Not open for further replies.

ahoodin

Programmer
Jul 25, 2001
48
US
I am attempting to delete a memory mapped file when I close down my data server.

if(hMMF != NULL)
{
if (!CloseHandle(hMMF))
lerror(GetLastError());
hMMF = NULL;
}

HFILE_ERROR ==OpenFile("TESTMMF.DAT",&of,OF_DELETE);

every other time the file stays. I did try to do a DeleteFile() operation and received:
Access denied error.

Has anybody else seen this type of problem?

Asher

 
HFILE_ERROR ==OpenFile("TESTMMF.DAT",&of,OF_DELETE);


you have a double equals here... dunno if that is a problem

Have you tried "UnmapViewOfFile" ??? Also to create it did you try CreatFileMapping followed by a mapViewOfFile?

Matt
 
thx Matt.

I have obtained the answer.

If I pass NULL to the original CreateFile, then I get a temporary file that is backed up by a pagefile. Also I can use DELETE_ON_CL0SE option with the call to CreateFile if I choose to use a file name.

thx,
Asher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top