Go Down

Topic: Re-implementing serial monitor (serial read) C++ (Read 2915 times) previous topic - next topic

Zac

C++, I'm using a PC with window 7 OS, and netbean or QT creator with the minGW compiler set.


PaulS


Zac

So am I right in thinking there is no simple way to only call a read byte function when a byte is present in the buffer to be read?


PaulS

I looked at the SerialPort documentation for C#, and I don't see a method of determining whether there is data to read, or not.

On the other hand, the derivation path for SerialPort makes it just another stream reader, and stream readers know to stop when the stream is empty. There might be an eof() function somewhere in it's derivation path that you could use to see if you are at the end of the stream.

If you use a thread to read the port, it doesn't matter that the thread blocks waiting for data.

Go Up