in reply to Reading from a serial device
In your fourth alternative, you would probably be better to use read(1) to read a single byte.
The lookfor method without parameters is non-blocking. As you haven't set are_match, it is waiting for "\n" and returns "" if this has not yet been found (it doesn't wait for it). So you may have two problems: the character hasn't arrived yet or the character isn't followed by a "\n". In either case lookfor() will return "".
|
|---|