copyFile()
Copies the specified source file to the specified target file or to the specified directory.
Synopsis
bool copyFile(string source, string target [, bool par3]);
Parameters
Parameter | Meaning |
---|---|
source | Source directory. You can specify an absolute path or a relative path from the PROJ_PATH directory. NOTE: An empty string "" is interpreted as PROJ_DIR. If an empty string "" is used as source, the whole project is copied to the given path. |
target | Target directory. You can specify an absolute path or a relative path from the PROJ_PATH directory. NOTE: an empty string "" is interpreted as PROJ_DIR. |
par3 |
(Preserve bit), optional parameter. If the parameter is not available the default value is used. The default = false. 0 means that the File date = current time. If the value is 1 (TRUE) the target file gets the same time as the source file. Authorizations are either granted with user +rw or go+r (Read and write rights for the user, read rights for a group and others) 1 time and authorization are imported (getFileTimes() setFileTimes() ) |
Return Value
If copying unsuccessful 0, copying OK 1.
Errors
-
Description
The file specified in source is copied to the file specified in target, the source and target directory must also be specified. Nonexistent subdirectories are automatically created.
main()
{
bool ok = 0;
// The file in c:/test1/test.txt is
// copied to c:/test2/test.txt.
ok = copyFile ("c://test1//test.txt","c://test2//test.txt");
if(!ok)
{
//...Error handling...;
DebugN("File was not copied", ok);
}
else
{
DebugN("File was not copied", ok);
}
}
Assignment
Availability
CTRL