Skip to content

Write_Block

Include: Use System\FileSystem.pkg

See Also: Direct_Output, Append_Output, Read_Block, Write, Write_Line, Set_Channel_Position, Sequential Channels

Purpose

Writes bytes from a String or UChar[] to a sequential output channel.

Syntax

Write_Block [Channel {ChannelNumber}] {Value} {Count}

Arguments

{Value} : String or UChar[] data to write.

{Count} : Number of bytes to write. -1 or any non-positive count writes the full value. A positive count writes at most that many bytes; a count larger than the value writes the available bytes only.

Behavior

For non-UChar[] arrays, Write_Block raises Cannot convert/write block.

Use Seq_New_Channel when opening files in application code; see Sequential Channels.

Example

Handle hFile
String sData

Move "12345" to sData
Get Seq_New_Channel to hFile
Direct_Output Channel hFile FILE "test1.dat"
Write_Block Channel hFile sData 3
Close_Output Channel hFile
Send Seq_Release_Channel hFile