title: Read/write into a device in C++
body: <p>How can I read/write to a device in C++? the device is in <code>/dev/ttyPA1</code>.<br>
  I thought about fstream but I can't know if the device has output I can read without blocking the application.<br>
  My goal is to create and application where you write something into the terminal and it gets sent into <code>/dev/ttyPA1</code>. If the device has something to write back it will read it from the device and write to screen. If not it will give the user prompt to write to the device again.<br>
  How can I do this?</p>