Share via


Deleting a File or a Directory (Windows CE 5.0)

Send Feedback

After you are finished with a file, close the file handle by using 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 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 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 of the files in the directory before calling RemoveDirectory.

See Also

File System Operations

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.