FWRITE

Concept Link IconSee also

Write a number of data items of the same type to a file from data stored in a 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 = FWRITE(Filename, Handle, Size, N);

Return type: LONG.

Argument

Meaning

Filename

The name of the file to which the data is to be written. 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 from 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 written. Any numeric type.

Execution

Data items up to the specified number are written to the file. The buffer must be previously allocated with ALLOC_BUFFER, which also supplies the handle, or FILETOBUF.

Return: 1 if successful, else 0.

Example

'write 20 items of 4 bytes each

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