Difference between revisions of "BINREAD()"
Yvonne.milne (Talk | contribs) m (1 revision) |
Helen.george (Talk | contribs) |
||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to read a character string from a binary file | Function to read a character string from a binary file | ||
− | |||
==Syntax== | ==Syntax== | ||
BINREAD([<expN1>,<expN2>]) | BINREAD([<expN1>,<expN2>]) | ||
− | |||
==See Also== | ==See Also== | ||
[[BIN2I()]], [[BIN2L()]], [[BIN2W()]], [[BINCLOSE()]], [[BINCREATE()]], [[BINOPEN()]], [[BINSEEK()]], [[BINWRITE()]], [[FREAD()]], [[FREADSTR()]], [[I2BIN()]], [[L2BIN()]] | [[BIN2I()]], [[BIN2L()]], [[BIN2W()]], [[BINCLOSE()]], [[BINCREATE()]], [[BINOPEN()]], [[BINSEEK()]], [[BINWRITE()]], [[FREAD()]], [[FREADSTR()]], [[I2BIN()]], [[L2BIN()]] | ||
− | |||
==Description== | ==Description== | ||
The BINREAD() reads a character string from a binary file that was 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> value represents the number of bytes to read. The BINREAD() function reads the specified number of bytes from the file starting at the current position of BINSEEK(). BINREAD() returns the character string in the specified length of <expN2> if successful, or a string of length zero if unsuccessful. The binary conversion functions may be used in conjunction with the binary file functions. | The BINREAD() reads a character string from a binary file that was 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> value represents the number of bytes to read. The BINREAD() function reads the specified number of bytes from the file starting at the current position of BINSEEK(). BINREAD() returns the character string in the specified length of <expN2> if successful, or a string of length zero if unsuccessful. The binary conversion functions may be used in conjunction with the binary file functions. | ||
− | |||
==Example== | ==Example== | ||
Line 26: | Line 22: | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[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:23, 7 December 2012
Contents
Purpose
Function to read a character string from a binary file
Syntax
BINREAD([<expN1>,<expN2>])
See Also
BIN2I(), BIN2L(), BIN2W(), BINCLOSE(), BINCREATE(), BINOPEN(), BINSEEK(), BINWRITE(), FREAD(), FREADSTR(), I2BIN(), L2BIN()
Description
The BINREAD() reads a character string from a binary file that was 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> value represents the number of bytes to read. The BINREAD() function reads the specified number of bytes from the file starting at the current position of BINSEEK(). BINREAD() returns the character string in the specified length of <expN2> if successful, or a string of length zero if unsuccessful. 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)