Click to See Complete Forum and Search --> : File Delete


maruf10
February 2nd, 2009, 03:24 PM
i have written a code in C using win32 API( FindFirstFile() , FindNextFile() , FindClose() )
now i want to delete some files named "newfolder.exe"
i know the path and file name
how can i do it??

ovidiucucu
February 2nd, 2009, 03:42 PM
DeleteFile (http://msdn.microsoft.com/en-us/library/aa363915(VS.85).aspx)

maruf10
February 3rd, 2009, 03:05 AM
using DeleteFile(filePath) my code can not delete all "newfolder.exe" file.where is the bug?
it produces the following output:

C:\Documents and Settings\maruf\Desktop\newfolder.exe
file delete failed

D:\newfolder.exe
file delete success

E:\newfolder.exe
file delete success

F:\newfolder.exe
file delete success

G:\newfolder.exe
file delete success

H:\newfolder.exe
file delete failed

K:\newfolder.exe
file delete success

total files 7


i can not delete those two undeleted file manually :(

Marc G
February 3rd, 2009, 04:00 AM
Maybe a permission problem?

ovidiucucu
February 3rd, 2009, 06:52 AM
See how to get the reason for a failure of a SDK function (http://www.codeguru.com/forum/showthread.php?t=318721).