index

Varkon MBS Programmers manual

# inbin - Procedure

## Description

Reads unformatted binary data from a file. An optional parameter can be used to specify conversion between 16/32 bit integers, 32/64 bit floats and variable length strings.

## Syntax

      inbin(f, data, size);

      file    f;
      anytype data;
      int     size;

## Principal parameters

f | - The name of a filevariable associated with a file open for read or update (R or U)
data | - A variable, possibly indexed, to recieve the data to be read

## Optional parameters

size | - The basic size of the datatype to be read. Only valid for INT/FLOAT or STRING variables.

## Comments

inbin() always reads as many bytes of data from the file as needed to match the variable specified to recieve the data. If the variable is indexed all the elements of the variable are read.

If no size is specified inbin() reads as many bytes as needed for the actual type of the variable ie. 4 bytes for an INT, 8 bytes for a FLOAT and so on. If a size is specified, inbin() reads the number of bytes specified and converts the data to the size used by Varkon. An 8 bit integer (1 byte) or a 16-bit integer (2 bytes) for example may be read into a Varkon INT which is 32 bits. A 32 bit float (4 bytes) may be read into a Varkon FLOAT which is 64 bits.

## See also

outbin() and iostat()

Varkon version 1.19C svn# 120