[Gambas-user] Serial I/O with byte data
Tobias Boege
taboege at ...626...
Sun May 14 21:56:44 CEST 2017
On Sun, 14 May 2017, alexchernoff wrote:
> Good day all,
>
> Anyone know how to read data received on serial port into an array of bytes
> instead of string?
>
I think that's not possible.
> String gets unreadable binary characters, so how can I
> put them into byte[] or so?
>
This shouldn't be a problem. Gambas Strings are not null-terminated and can
contain any sequence of bytes, which includes non-printable characters (which
I think is what you meant by "unreadable" characters).
If you insist on a Byte[], read it into a String and use Byte[].FromString(),
but there is no way to go around the String, AFAICT (and that is because
there is no need to, as Strings can handle binary data just fine).
Regards,
Tobi
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list