UCREATE Command

The UCREATE command creates and opens a specified file on the host system.

Format

UCREATE <path> TO FileHandle THEN statement(s) ELSE statement(s)

Parameter(s)

path

File expressed by the valid path name, within quotes.

FileHandle

Contains the file descriptor of the file that is open for write only.

Description

If the file already exists, UCREATE shortens the length of the file to 0. If the file does not exist, UCREATE creates a new file. The file pointer is positioned at the beginning of the file. All future references to this file must be made through FileHandle. If an error occurs, the ELSE path executes.

Example

This example below creates the file \books\chap1.txt. If the file presently exists, UCREATE truncates the file to zero bytes. In either case, the file opens for reading/writing and the file descriptor is returned in the variable FILEDES. If an error occurs, the ELSE clause executes:

FILENAME="c:\books\chap1.txt"

UCREATE FILENAME TO FILEDES ELSE

   PRINT "Unable to create and open ":FILENAME

   STOP

END

UCLOSE FILEDES ELSE STOP

See Also

O/S Interoperability Commands

UCLOSE Command

UDELETE Command

UERROR Function

UEXECUTE Command

ULOCK Command

ULSEEK Function

UMESSAGE Command

UOPEN Command

UREAD Command

UREADLINE Function

USYSTEM Function

UWAITFOR Command

UWRITE Command