allowCreate

Type: Boolean

Set the allowCreate property of the FileNode class to false before the file is opened to specify that the file cannot be created. The default value is true; that is, the file can be created if it does not exist.

The following example shows the use of the allowCreate property.

vars
    fileName : String;
    file     : File;
    count    : Integer;
begin
    count := 0;
    create file transient;
    file.mode         := File.Mode_IO;
    file.kind         := File.Kind_Unknown_Text;
    file.allowReplace := false;
    file.allowCreate  := false;
    file.open(fileName);
    ...           // do some processing here
end;

When this property is set to false and the file does not exist, an exception is raised. For example, if the mode property has a value of File.Mode_Output, File.Mode_IO, or File.Mode_Append and the file is missing, the file is not created.

This property applies only to the File class. It is ignored when set for the FileFolder class.