FWRITE()

Writes characters to a file.

Syntax

FWRITE( <nHandle>, <cBuffer>, [<nBytes>] ) --> nBytesWritten

Arguments

<nHandle> DOS file handle number.

<cBuffer> Character expression to be written.

<nBytes> The number of bytes to write.

Returns

<nBytesWritten> the number of bytes successfully written.

Description

This function writes the contents of <cBuffer> to the file designated by its file handle <nHandle>. If used, <nBytes> is the number of bytes in <cBuffer> to write.

The returned value is the number of bytes successfully written to the DOS file. If the returned value is 0, an error has occurred (unless this is intended). A successful write occurs when the number returned by FWRITE() is equal to either LEN( <cBuffer>) or <nBytes>.

The value of <cBuffer> is the string or variable to be written to the open DOS file <nHandle>.

The value of <nBytes> is the number of bytes to write out to the file. The disk write begins with the current file position in <nHandle>. If this variable is not used, the entire contents of <cBuffer> is written to the file. To truncate a file. a call of FWRITE( nHandle, "", 0 ) is needed.
Examples
      nHandle:=FCREATE('x.txt')
      FOR X:=1 to 10
        FWRITE(nHandle,STR(x))
      NEXT
      FCLOSE(nHandle)
Status

Ready

Compliance

This function is not CA-Clipper compatile since it can writes strings greather the 64K

Files

Library is Rtl

See Also