Difference between revisions of "BINSEEK()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to position the file pointer in binary file
 
Function to position the file pointer in binary file
 
  
 
==Syntax==
 
==Syntax==
 
BINSEEK([<expN1C>,<expN2>,<expN3>])
 
BINSEEK([<expN1C>,<expN2>,<expN3>])
 
  
 
==See Also==
 
==See Also==
 
[[BIN2I()]], [[BIN2L()]], [[BIN2W()]], [[BINCLOSE()]], [[BINCREATE()]], [[BINOPEN()]], [[BINREAD()]], [[BINWRITE()]], [[FSEEK()]], [[I2BIN()]], [[L2BIN()]]
 
[[BIN2I()]], [[BIN2L()]], [[BIN2W()]], [[BINCLOSE()]], [[BINCREATE()]], [[BINOPEN()]], [[BINREAD()]], [[BINWRITE()]], [[FSEEK()]], [[I2BIN()]], [[L2BIN()]]
 
  
 
==Description==
 
==Description==
 
The BINSEEK() function is used to position to a byte offset within a binary file opened with the BINCREATE() or BINOPEN() functions.  The <expN1> is the file descriptor which was returned when the file was opened with either the BINCREATE() or BINOPEN() functions.  The <expN2> is the byte offset to move the file pointer based on the value defined by <expN3>.  The value of <expN3> represents a positioning mode that defines the position from which to start the byte offset.  The positioning mode options are:
 
The BINSEEK() function is used to position to a byte offset within a binary file opened with the BINCREATE() or BINOPEN() functions.  The <expN1> is the file descriptor which was returned when the file was opened with either the BINCREATE() or BINOPEN() functions.  The <expN2> is the byte offset to move the file pointer based on the value defined by <expN3>.  The value of <expN3> represents a positioning mode that defines the position from which to start the byte offset.  The positioning mode options are:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 25: Line 21:
 
|-
 
|-
 
|}
 
|}
 
  
 
The BINSEEK() function returns the new file position relative to the beginning of the file.  The binary conversion functions may be used in conjunction with the binary file functions.
 
The BINSEEK() function returns the new file position relative to the beginning of the file.  The binary conversion functions may be used in conjunction with the binary file functions.
 
  
 
==Example==
 
==Example==
Line 41: Line 35:
 
</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:24, 7 December 2012

Purpose

Function to position the file pointer in binary file

Syntax

BINSEEK([<expN1C>,<expN2>,<expN3>])

See Also

BIN2I(), BIN2L(), BIN2W(), BINCLOSE(), BINCREATE(), BINOPEN(), BINREAD(), BINWRITE(), FSEEK(), I2BIN(), L2BIN()

Description

The BINSEEK() function is used to position to a byte offset within a binary file opened with the BINCREATE() or BINOPEN() functions. The <expN1> is the file descriptor which was returned when the file was opened with either the BINCREATE() or BINOPEN() functions. The <expN2> is the byte offset to move the file pointer based on the value defined by <expN3>. The value of <expN3> represents a positioning mode that defines the position from which to start the byte offset. The positioning mode options are:

Offset Description
0 Start from the beginning of file
1 Start from the current position
2 Start from the end of file

The BINSEEK() function returns the new file position relative to the beginning of the file. The binary conversion functions may be used in conjunction with 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)