@BINFILE [VDS6] |
|
| Top Previous Next | |
Syntax:
@BINFILE(EOF,<file_id>)
@BINFILE(POS,<file_id>)
@BINFILE(SIZE,<file_id>)
@BINFILE(READ,<file_id>,TEXT|BINARY|HEX,<value>)
Description:
[VDS6] This command has been superseded by new file input and output functions.
This function is used when reading and writing binary disk files. The options are:
@BINFILE(EOF,...) |
test if <file_id> is at the end of the file |
@BINFILE(POS,...) |
obtain the current position of file <file_id> |
@BINFILE(SIZE,...) |
return the size of file <file_id> |
@BINFILE(READ,...) |
read <value> bytes from file <file_id>, returning them in the format specified |
where <file_id> may be a number in the range 1 to 4.
If the third parameter of @BINFILE(READ,...) is TEXT then all non-printable characters (including CR/LF) are converted to periods. If it is BINARY then the function returns a series of values separated by the character specified using the command OPTION FIELDSEP. This is the character '|' by default. If HEX then the data is returned as a string of two digit hex numbers each separated by a single space.
OK:
Set to false if a problem occurred during a file operation.
Example:
list create,1
%S = 0
binfile seek,1,%S
while @not(@binfile(EOF,1))
%D = @binfile(read,1,HEX,16)
binfile seek,1,%S
%T = @binfile(read,1,TEXT,16)
if @greater(48,@len(%D))
repeat
%D = %D" "
until @equal(@len(%D),48)
end
list add,1,@hex(%S,8)@tab()%D@tab()%T
%S = @sum(%S,16)
wend
See also: