locked
write sbyte in serialport. RRS feed

  • Question

  • Hi,

    How can I write sbyte in serialport?.

    I need same thing like:

    serialport _serialport;

    _serialport.write(sbyte);

    Converting sbytes to bytes will give me problems at the other backend.

    How can I get it?.

     

    thanks

    Tuesday, June 1, 2010 11:32 AM

Answers

  • Ok it works with

     

      sbyte[] signed = { -2, -1, 0, 1, 2 };
      byte[] unsigned = new byte[signed.Length];
      Buffer.BlockCopy(signed, 0, unsigned, 0, signed.Length);
    

     

    • Marked as answer by Haythem77 Tuesday, June 1, 2010 12:27 PM
    Tuesday, June 1, 2010 12:27 PM