Share via


Deleting a File or a Directory (Windows Embedded CE 6.0)

1/6/2010

After you are finished with a file, close the file handle by calling the CloseHandle function. CloseHandle is a generic function that closes a variety of handles, including the handle to a file. If you leave a file open when your application terminates, Windows Embedded CE automatically closes the file.

To close and delete a file

  1. Close the file by calling the CloseHandle function.

  2. Delete the file by calling the DeleteFile function.

    Windows Embedded CE cannot delete a file that has an open handle.

Call the RemoveDirectory function, with the full path of the directory in the lpPathName parameter, to delete a directory. You must delete all files in the directory before calling RemoveDirectory.

See Also

Concepts

Creating, Deleting, and Maintaining Files
File System Operations