Question How to send and receive C-Strings from serial COM-Port

Datensalat

New member
Joined
Jun 27, 2019
Messages
1
Programming Experience
5-10
Hello,

I don't know a way to send and receive C-Strings (ASCII / UTF8) from / to serial COM-Port.

I thought like this:
RScomm = new SerialPort();
UTF8Encoding utf8 = new UTF8Encoding();
string writebuffer;
Byte[] uft8Bytes = utf8.GetBytes(writebuffer+"\u0000");

But how do I feed this to
RScomm.Write()-Routine? It needs an unicode C#-String?
Is there a way to manipulate a C#-String that looks C# "from outside", but has C-String-Bytes in it?

What is the best way when receiving C-string from COM-Port to transform it in C#-String?

Any help would be very much appreciated.
 
Back
Top Bottom