BINWRITE()

From Recital Documentation Wiki
Revision as of 16:06, 26 November 2009 by Helengeorge (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 Server, Recital