FREAD

Concept Link IconSee also

Read a number of data items of the same type from a file and stores them in a memory buffer.

WebVue support - Yes.

Before using any of the file management instructions, except FSTAT, RENAME, UNLINK, FILETOBUF or BUFTOFILE, you must first open the file using an FOPEN instruction.

Before any program including the FOPEN instruction ends, it must execute an FCLOSE instruction.

Syntax

LongVal = FREAD(Filename, Handle, Size, N);

Return type: LONG.

Argument

Meaning

Filename

The name of the file from which the data is to be read. Type STR.
If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the referenced file is on that computer.

Handle

The location of the memory buffer into which the data is read. Type LONG.

Size

The size in bytes for each data item. Any numeric type.

N

The number of items to be read. Any numeric type.

Execution

Data items are read into a memory buffer. The buffer must be previously allocated with ALLOC_BUFFER, which also supplies the handle.

Return: 1 if successful, else 0.

Example

'read 20 data items of 4 bytes

i1 = FREAD("histo.fil",handle,4,20);