关于删除文件的问题
请教各位 怎样调用系统API删除指定目录的文件,如删除F:\DB8.mdb,请给出点原代码,谢谢各位! 问题点数:0、回复次数:7Top
1 楼nzh517(沙中泥)回复于 2003-12-03 11:05:26 得分 0
BOOL DeleteFile(
LPCTSTR lpFileName // pointer to name of file to delete
);
Parameters
lpFileName
Points to a null-terminated string that specifies the file to be deleted.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
例:
DeleteFile('F:\DB8.mdb');Top
2 楼mistjin(今天天气不错)回复于 2003-12-03 14:50:18 得分 0
楼上的一点机会也不给楼下的!Top
3 楼boytomato(深爱一人叫颖的女孩!)回复于 2003-12-03 19:14:10 得分 0
http://expert.csdn.net/Expert/topic/2494/2494130.xml?temp=.5412714Top
4 楼konhon(优华)回复于 2003-12-03 19:25:44 得分 0
DelteFileTop
5 楼jiayodo(爱上一只猪)回复于 2003-12-03 19:34:34 得分 0
楼上说的够清楚了Top
6 楼ouyang75928(Thinking in Pascal)回复于 2003-12-04 11:58:56 得分 0
当strFileName正在被使用时,用DeleteFile可能会失败。
改用MoveFileEx(PChar(strFileName), nil, MOVEFILE_DELAY_UNTIL_REBOOT);重启后肯定能删除掉。
Top
7 楼angelface(§<@#$&^%$>§)回复于 2003-12-07 18:40:04 得分 0
DeleteFile就行了Top




