March 01, 2021, 10:40:29 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bmx] CopyFile by Perturbatio [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bmx] CopyFile by Perturbatio [ 1+ years ago ] (Read 538 times)
BlitzBot
Jr. Member
Posts: 1
[bmx] CopyFile by Perturbatio [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:40 AM »
Title :
CopyFile
Author :
Perturbatio
Posted :
1+ years ago
Description :
Copies a source file to the destination
Code :
Code: BlitzMax
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 :
Grey Alien(Posted 1+ years ago)
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.
Perturbatio(Posted 1+ years ago)
I updated it slightly to take into account the BufSize parameter of CopyStream.
D4NM4N(Posted 1+ years ago)
great!, and to think i was about 2 research writing my own :)just what i was after!thanks
tonyg(Posted 1+ years ago)
Can't you use BlitzMax's CopyFile function which does the same thing? Make sure you're updated.
Perturbatio(Posted 1+ years ago)
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).
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bmx] CopyFile by Perturbatio [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal