Function copyFile(Byval sSource As String, Byval sDestination As String, Byval bOverWrite As Integer) As Integer
On Error Resume Next
copyFile = False
If isFile(sSource) Then
If bOverWrite Or (Not isFile(sDestination)) Then
Filecopy sSource, sDestination
If isFile(sDestination) Then copyFile = True
End If
End If
End Function
例子:
If copyFile("c:/temp/temp.doc", "c:/documents/temp.doc") Then
Msgbox "File c:/temp/temp.doc was copied successfully ."
Else
Msgbox "File c:/temp/temp.doc was NOT copied."
End If
博客展示了一个C语言的文件复制函数copyFile,该函数接收源文件路径、目标文件路径和是否覆盖的标志作为参数,通过判断源文件是否存在、目标文件是否可覆盖等条件进行文件复制操作,并给出了调用该函数的示例。
21万+

被折叠的 条评论
为什么被折叠?



