Copy file
BlitzMax Forums/BlitzMax Programming/Copy file
| ||
I need to have BMax copy files from one directory to another. I don't see a File System command to perform this. Any suggestions? |
| ||
either use System_ "copy c:\myfile.txt d:\myfile.txt" or read it into a stream and write it out elsewhere |
| ||
Thanx Pert |
| ||
in fact, I'm feeling nice:Function CopyFile:Int(SourceFile:String, DestinationFile:String, AutoReplace=False) 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) CloseStream(SourceStream) CloseStream(DestStream) Return True End Function |
| ||
Pert- that 2nd piece of sample code was just what I needed. Thanx again. |