Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

FileReadBlock

  • Last UpdatedJul 18, 2023
  • 1 minute read

Reads a number of characters from a file. The buffer can contain less characters than requested if the end of file is reached. A maximum of 255 characters can be read in each call. The data should be treated as a binary data and should not be passed to string functions. You may use StrGetChar() function to extract each character from the buffer, or pass the buffer to another function which will accept binary data.

Syntax

FileReadBlock(File, Buffer, Length)

File:

The file number.

Buffer:

The buffer to return the binary data. This may be a string or a string packed with binary data. The string terminator is ignored and the length argument specifies the number of characters to write. Must be a string variable.

Length:

The number of characters to read.

Return Value

The number of characters read from the file. When the end of the file is found 0 will be returned. If an error occurs -1 will be returned and IsError() will return the error code.

FileOpen, FileClose, FileRead, FileWriteBlock, StrGetChar

Example

// read binary file and copy to COM port

length = FileReadBlock(File, buf, 128);

WHILE length > 0 DO

ComWrite(hPort, buf, length, 0);

length = FileReadBlock(File, buf, 128);

END

See Also

File Functions

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in