Read_Block¶
Include: Use System\FileSystem.pkg
See Also: Direct_Input, Read, Read_Line, Read_Hex, Write_Block, Set_Channel_Position, Sequential Channels
Purpose¶
Reads bytes from a sequential input channel into a String, WString, or UChar[].
Syntax¶
Read_Block [Channel {ChannelNumber}] {Variable} {Count}
Arguments¶
{Variable}
: String, WString, or UChar[] destination.
{Count}
: Number of bytes to read. -1 reads all remaining data. A count larger than the available data returns the available bytes only.
Behavior¶
String destinations receive bytes as a string. UChar[] destinations receive bytes in an array. WString destinations read bytes as UTF-16 units with a zero terminator safeguard.
Use Seq_New_Channel when opening files in application code; see Sequential Channels.
Example¶
Handle hFile
String sData
Get Seq_New_Channel to hFile
Direct_Input Channel hFile FILE "binary: test1.dat"
Read_Block Channel hFile sData -1
Close_Input Channel hFile
Send Seq_Release_Channel hFile