Difference between revisions of "BINWRITE()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to write an expression to a binary file
 
Function to write an expression to a binary file
 
  
 
==Syntax==
 
==Syntax==
 
BINWRITE(<expN>,<expC>)
 
BINWRITE(<expN>,<expC>)
 
  
 
==See Also==
 
==See Also==
 
[[BIN2I()]], [[BIN2L()]], [[BIN2W()]], [[BINCLOSE()]], [[BINCREATE()]], [[BINOPEN()]], [[BINREAD()]], [[BINSEEK()]], [[FWRITE()]], [[I2BIN()]], [[L2BIN()]]
 
[[BIN2I()]], [[BIN2L()]], [[BIN2W()]], [[BINCLOSE()]], [[BINCREATE()]], [[BINOPEN()]], [[BINREAD()]], [[BINSEEK()]], [[FWRITE()]], [[I2BIN()]], [[L2BIN()]]
 
  
 
==Description==
 
==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.
 
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==
 
==Example==
Line 27: Line 23:
  
  
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Binary File Access]]
 
[[Category:Binary File Access]]
 
[[Category:Binary File Access Functions]]
 
[[Category:Binary File Access Functions]]

Revision as of 11:24, 7 December 2012

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)