Madfun00
asked on
how to delete file
Here is what my problem is
I am reading stuff form a file, into the program. When it is done i want to delete the file from which i read in. But can't figure out a way of doing this. And need help :)
I am reading stuff form a file, into the program. When it is done i want to delete the file from which i read in. But can't figure out a way of doing this. And need help :)
ASKER
I am sorry, doing it in unix but thank u
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks alot
ASKER
i gave u the points right?? not sure if i did on didn't
That works, but it is not a very efficient way to delete a file. It requires that a new thread be started for the command processor and the command procssor has to be loaded and initialized in that thread, then the file is deleted, then the command processor terminated and the thread deleted.
You can just use the standard C procedure called remove(). Or you can use the UNIX system call called "unlink()" (I think that is the name.) to delete a file.
You can just use the standard C procedure called remove(). Or you can use the UNIX system call called "unlink()" (I think that is the name.) to delete a file.
madfun00: yes you did.
nietod: i guess you're right. but if this is done only once, it doesn't really matter, does it? i thought that there were C fcns to do the job but i didn't know what they were. thanks for the info.
nietod: i guess you're right. but if this is done only once, it doesn't really matter, does it? i thought that there were C fcns to do the job but i didn't know what they were. thanks for the info.
>> but if this is done only once, it doesn't
>> really matter, does it?
Not too much. But its a very round-about and innefficient solution. its like mailing a letter from NY to LA by getting on a plane and going from NY to LA then putting the letter in a mail box 1 block from its destination in LA.
>> really matter, does it?
Not too much. But its a very round-about and innefficient solution. its like mailing a letter from NY to LA by getting on a plane and going from NY to LA then putting the letter in a mail box 1 block from its destination in LA.
ASKER
Thank u mournblade, and nietod. It is interesting to see how much there is that i still need to know:). And thanks to both of u for the interesting solutions. I am already done and sumited my proj
regards
regards
BOOL DeleteFile(
LPCTSTR lpFileName // pointer to name of file to delete
);