(AGK version: 108.13)
Submitted: 2013-06-14 10:33:45
copyFile("my_image.jpg", "duplicate_image.jpg")
end

function copyFile(fileName$, newName$)
// open the two files
sourceFile
= OpenToRead(fileName$)
destFile
= OpenToWrite(newName$)

// while we are not at the end of the source file
while FileEOF(sourceFile) = 0
// write the next byte in the source file to the dest file
// by going through it byte by byte, this function will be able to copy any file, regardless of format
WriteByte(destFile, ReadByte(sourceFile))
endwhile

// close the files
CloseFile(sourceFile)
CloseFile(destFile)
endfunction
Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.