1、文件拷贝
函数声明:
FUNCTION boolean CopyFileA(ref string cfrom, ref string cto, boolean flag) LIBRARY "Kernel32.dll"
调用:
string ls_source, ls_des
boolean lb_flag, lb_rtn
lb_flag = false
ls_source = "c:\book.xls" //源文件
ls_des = "C:\tmp\111.xls" //目标文件
lb_rtn = CopyFileA(ls_source, ls_des, lb_flag)
MessageBox("文件拷贝", string(lb_rtn))
2、删除文件
函数声明:
FUNCTION boolean DeleteFileA(ref string filename) LIBRARY "Kernel32.dll"
调用:
string ls_file
boolean lb_rtn
ls_file = "C:\tmp\111.xls"
lb_rtn = DeleteFileA(ls_file)
MessageBox("文件删除", string(lb_rtn))
或者用PB本身的函数FileDelete()来删除文件。
pb 有文件操作 函数的 FileCopy FileDelete
FileCopy ("jazz.gif" ,"C:\emusic\jazz.gif", FALSE)
FileDelete("C:\emusic\jazz.gif")
具体的参数,返回值可以查看PB的帮助