WriteBin Statement

Writes binary data to a file or communications port.

Syntax
WriteBin #portNumber, data

WriteBin #portNumber, array(), count

Parameters

Portnum
ID number that specifies the file or communications port. File number can be specified in BOpen statement. Communication port number can be specified in OpenCom (RS-232C) or OpenNet (TCP/IP) statements.
data
Specify the data to be written as an integer or an expression.
array()
Specifies the name of the Byte, Integer, or Long type variable that contains the data bytes to be written. Specify a one dimension array variable.
count
Specify the number of bytes to be written. The specified count has to be less than or equal to the number of array elements and also smaller than 256 bytes. If the communication port (TCP/IP) is the subject, the count has to be less than or equal to the number of array and also smaller than 1024 bytes.

Note


  • About the Controllers to use

    For T/VT series, an error will occur at operation when RS-232C port of the Controller is specified.


See Also
ReadBin, Write

WriteBin Statement Example

Integer i, data(100)

OpenCom #1
For i = 0 To 100
  WriteBin #1, i
Next i
WriteBin #1, data(), 100
CloseCom #1