Writing STRINGS to serial port in C++ linux

后端 未结 1 468
遥遥无期
遥遥无期 2021-02-15 04:33

I know this question is scattered all over the internet, but still, nothing is getting me completely there yet. I want to write data to a serial port in C++ (linux) for a a Prop

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-15 05:26

    I'm happy to solve my own solution but yet disappointed to not have seen the trivial matter much sooner. char by default are signed in c++, which makes it holding the range -128 to 127. However, we are expecting the ASCII values which are 0 to 255. Hence it's as simple as declaring it to be unsigned char str[] and everything else should work. Silly me, Silly me.

    Still, Thank you everyone for helping me!!!

    0 讨论(0)
提交回复
热议问题