Writes specified number of bytes from array to serial port.
| Visual Basic .NET | Function WriteArray(ByVal DataBuffer As array of Byte, ByVal BytesToWrite As UInt32) As UInt32
|
|---|---|
| Visual C# | UInt32 WriteArray(byte[] DataBuffer, UInt32 BytesToWrite);
|
DataBuffer
[in] SafeArray of bytes to write.
BytesToWrite
[in, optional] Number of bytes to write to serial port.
Number of bytes written to serial port. It can write fewer bytes than requested; the return value must be noted, and the reminder of the operation should be retried when possible.
The method may throw exception. Refer to Handle errors sample for details.
byte[] ReadBuffer = System.Text.Encoding.ASCII.GetBytes("Write Data");
try
{
ftspcControl1.WriteArray(ReadBuffer, (uint)ReadBuffer.GetLength(0));
}
catch (FTSPCException E)
{
MessageBox.Show("Error " + E.ErrorCode.ToString() + "\r\n" +
E.ErrorSource, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}