This code has been declared by its author to be Public Domain code.
Download source code | CopyFile by Perturbatio | 2005 |
| |
|
Copies a source file to the destination |
Function CopyFile:Int(SourceFile:String, DestinationFile:String, AutoReplace:Int=False, BufSize:Int=4096)
If FileType(SourceFile) <> 1 Then Return False
If FileType(DestinationFile) = 1 And Not AutoReplace Then Return False
Local SourceStream:TStream = OpenStream(SourceFile,True,False)
Local DestStream:TStream = OpenStream(DestinationFile,False,True)
CopyStream(SourceStream, DestStream, BufSize)
CloseStream(SourceStream)
CloseStream(DestStream)
Return True
End Function |
Comments |
Nice, it probably also works to copy read only CD-files to your computer and making them non-read only as you are not doing anything with the attributes.
|
|
I updated it slightly to take into account the BufSize parameter of CopyStream.
|
|
great!, and to think i was about 2 research writing my own :)
just what i was after!
thanks
|
|
Can't you use BlitzMax's CopyFile function which does the same thing? Make sure you're updated.
|
|
unless you need to do something specific that the BRL CopyFile doesn't do, I'd suggest using that instead (I wrote this before the BMax update).
|
Code Archives Forum