ReadBinary

Reads a binary value of a specified type from a file.

Syntax

ReadBinary(fileID, valueType)

Parameters

Parameter

Type

Description

fileID

number

File ID received from OpenFile function.

valueType

string

Binary type. Should be char, uchar, short, ushort, int, uint, int64, uint64, float or number

Return

The value read from the file.

Examples

Python

import nex
# open binary file in read mode
file = nex.OpenFile(r"C:\Data\binaryfile.dat", "r")
# read short (2-byte signed) value
shortValue = nex.ReadBinary(file, "short")
nex.CloseFile(file)

NexScript

% open binary file in read mode
file = OpenFile("C:\Data\binaryfile.dat", "r")
% read short (2-byte signed) value
shortValue = ReadBinary(file, "short")
CloseFile(file)