FileCopy
Copies a file
#include "file.bi"
FileCopy source, destination
or
#include "file.bi"
result = FileCopy( source, destination )
source
Returns 0 on success, or 1 if an error occurred.
Copies the contents of the source file into the destination file, overwriting the destination file if it already exists.
It is necessary to #include either "file.bi" or "vbcompat.bi" in order to gain access to this function.
Syntax
Usage
#include "file.bi"
FileCopy source, destination
or
#include "file.bi"
result = FileCopy( source, destination )
Parameters
source
A String argument specifying the filename of the file to copy from. This file must exist.
destinationA String argument specifying the filename of the file to copy to. This file will be overwritten if it exists. This file should not be currently referenced by any open file handles.
Return Value
Returns 0 on success, or 1 if an error occurred.
Description
Copies the contents of the source file into the destination file, overwriting the destination file if it already exists.
It is necessary to #include either "file.bi" or "vbcompat.bi" in order to gain access to this function.
Example
#include "file.bi"
FileCopy "source.txt", "destination.txt"
FileCopy "source.txt", "destination.txt"
Platform Differences
- Linux requires the filename case matches the real name of the file. Windows and DOS are case insensitive.
- Path separators in Linux are forward slashes /. Windows uses backward slashes \ but it allows forward slashes. DOS uses backward slashes \.
Differences from QB
- New to FreeBASIC. Existed in Visual Basic.
See also