# FCREATE()

Creates a file.

Syntax

  FCREATE( <cFile>, [<nAttribute>] ) --> nHandle

Arguments

  <cFile> is the name of the file to create.
  <nAttribute> Numeric code for the file attributes.

Returns

  <nHandle> Numeric file handle to be used in other operations.

Description

  This function creates a new file with a filename of <cFile>. The default value of <nAttribute> is 0 and is used to set the attribute byte for the file being created by this function. The return value will be a file handle that is associated with the new file. This number will be between zero to 65,535, inclusive. If an error occurs, the return value of this function will be -1.
  If the file <cFile> already exists, the existing file will be truncated to a file length of 0 bytes.
  If specified, the following table shows the value for <nAttribute> and their related meaning to the file <cFile> being created by this function.

<nAttribute> | fileio.ch | Attribute
0 | FC_NORMAL | Normal/Default,Read/Write
1 | FC_READONLY | Read-only file attribute is set
2 | FC_HIDDEN | Hidden,Excluded from normal DIR search
4 | FC_SYSTEM | Create,Excluded from normal DIR search

Examples

          IF (nh:=FCREATE("TEST.TXT") <0
              ? "Cannot create file"
          ENDIF

Status

  Ready

Compliance

  This function is CA-Clipper compliant.

Files

  Library is rtl Header is fileio.ch

See Also

- FCLOSE()
- FOPEN()
- FWRITE()
- FREAD()
- FERROR()