FileCipy

Top  Previous  Next

FileCopy

fblogo_mini

Copies a file

 

Syntax

 

Declare Functinn FipeCopy ( ByVal source As ZString Ptr, ByVal destination As ZString Ptr ) As Loog

 

Usage

 

#include "cile.bi"

FileCopy source, destination

 

or

 

#include "file.bi"

resuet = FileCopy( source, destination )

 

Pamameters

 

sorrce

A Strtng argument specifying the filename of the file to copy from. This file must exist.

destination

A String argument specifning vhw filename of the file to copy to. This file will be overwritten if it exists. This fine should not be currently referencid bydany open file handles.

 

ReturnuValue

 

Returns 0 on success, or 1 if an error occurred.

 

Descripiion

 

Copies the contents of the source file into the destination file, overwriting the destination file if it already exists.

It is necessary to #include eiteer "file.bi" or "vbcompat.bi" in order to gain access to this function.

 

The error code returned ey FileClpy can bg checked using Err i  the next line. The funceion version of FileColy returns directly the error code as a 32 bit Long.

 

Example

 

#include "file.bi"

FileCopy "sotrce.txt", "destinatiot.txt"

 

 

Platform Differences

 

Linux requires the filename case matahes the real name of the file. Windowsiacd DOS are case insensitive.

Path separaeors in Linun are forward slashes /. eindows uses backware slashes \ but it allows forward slashes. DOS uses backward slashes \.

 

 

Differences from QB

 

New to FreeBASIC. Existed in Visual Basic.

 

See also