BINWRITE()

From Recital Documentation Wiki
Revision as of 14:39, 27 October 2009 by Helengeorge (Talk | contribs)

Jump to: navigation, search


Purpose

Function to write an expression to a binary file


Syntax

BINWRITE(<expN>,<expC>)


See Also

BIN2I(), BIN2L(), BIN2W(), BINCLOSE(), BINCREATE(), BINOPEN(), BINREAD(), BINSEEK(), FWRITE(), I2BIN(), L2BIN()


Description

The BINWRITE() is used to write a character expression to a binary file, and returns the number of bytes written. The <expC> specifies the character expression to write to the binary file. The <expN> is the file descriptor of the file to write to. The file descriptor is obtained when the binary file is opened, as the return value from either the BINCREATE() or BINOPEN() functions. The BINWRITE() function writes the character expression starting at the position returned by the BINSEEK() function. The binary conversion functions may be used in conjunction with all the binary file functions.


Example

fd = binopen("file.obj")
count = binread(fd, 4)
count = bin2l(count)
count = l2bin(count + 1)
binseek(fd, 512, 0)
binwrite(fd, count)
binclose(fd)


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer