Difference between revisions of "BINCREATE()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to create a binary file
 
Function to create a binary file
 
  
 
==Syntax==
 
==Syntax==
 
BINCREATE([<expC>])
 
BINCREATE([<expC>])
 
  
 
==See Also==
 
==See Also==
 
[[BIN2I()]], [[BIN2L()]], [[BIN2W()]], [[BINCLOSE()]], [[BINOPEN()]], [[BINREAD()]], [[BINSEEK()]], [[BINWRITE()]], [[FCLOSE()]], [[FCREATE()]], [[FOPEN()]], [[I2BIN()]], [[L2BIN()]]
 
[[BIN2I()]], [[BIN2L()]], [[BIN2W()]], [[BINCLOSE()]], [[BINOPEN()]], [[BINREAD()]], [[BINSEEK()]], [[BINWRITE()]], [[FCLOSE()]], [[FCREATE()]], [[FOPEN()]], [[I2BIN()]], [[L2BIN()]]
 
  
 
==Description==
 
==Description==
 
The BINCREATE() function creates a new binary file.  The <expC> is the name of the file to be created.  BINCREATE() leaves the created file open, and  returns a file descriptor when successful, or a -1 if an error occurs.  Since the file descriptor is used to identify an open binary file, always assign the BINCREATE() return value to a memory variable.
 
The BINCREATE() function creates a new binary file.  The <expC> is the name of the file to be created.  BINCREATE() leaves the created file open, and  returns a file descriptor when successful, or a -1 if an error occurs.  Since the file descriptor is used to identify an open binary file, always assign the BINCREATE() return value to a memory variable.
 
  
 
==Example==
 
==Example==
Line 26: Line 22:
 
</code>
 
</code>
  
 
==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:14, 7 December 2012

Purpose

Function to create a binary file

Syntax

BINCREATE([<expC>])

See Also

BIN2I(), BIN2L(), BIN2W(), BINCLOSE(), BINOPEN(), BINREAD(), BINSEEK(), BINWRITE(), FCLOSE(), FCREATE(), FOPEN(), I2BIN(), L2BIN()

Description

The BINCREATE() function creates a new binary file. The <expC> is the name of the file to be created. BINCREATE() leaves the created file open, and returns a file descriptor when successful, or a -1 if an error occurs. Since the file descriptor is used to identify an open binary file, always assign the BINCREATE() return value to a memory variable.

Example

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