Anjz
Anjz

Reputation: 307

Read from serial port without removing from the buffer (linux)

In C/C++

How can I read from serial port, without removing the info I have already read from the buffer?

I want to do something like the Peek function of arduino (http://arduino.cc/en/Serial/Peek) in a linux machine.

Upvotes: 0

Views: 2605

Answers (1)

DrYap
DrYap

Reputation: 6647

The serial port is accessed as though it is a file using a file descriptor so a fgetc ungetc method should work.

Upvotes: 1

Related Questions