OSWRITE

OSWRITE

Top  Previous  Next

 

The OSWRITE statement writes an operating system file by pathname.

 

 

Format

 

OSWRITE expr TO path {ON ERROR statement(s)}

 

where

 

expris the data to be written.

 

pathis the pathname of the file to be written.

 

 

The OSWRITE statement provides a simple way for a program to write an operating system file by pathname rather than having to open the parent directory with OPENSEQ and then using WRITEBLK to write the data.

 

The data is written to the specified file with no modification. In particular, note that the translation of field marks to newlines that occurs when writing to directory files does not happen with this statement. Any existing data in the file will be overwritten, truncating the file if the old content was larger than the new data.

 

OSWRITE takes no part in the locking system. It is up to the application developer to ensure that concurrency issues are handled appropriately.

 

The ON ERROR clause is executed for serious fault conditions such as the inability to write the data to the file. The STATUS() function will return an error number and the OS.ERROR() function will provide further information about the operating system level error. If no ON ERROR clause is present, an abort would occur at these types of error.

 

 

Example

 

OSWRITE FAXDATA TO 'C:\FAXLOG'

 

This statement writes the content variable FAXDATA to an operating system file with pathname C:\FAXLOG.

 

 

See also:

OSDELETE, OSREAD