Reading from a serial device
Hello, I am trying to read from a device that spits out 2 values simultaneously per line when i read from the device through cat /dev/device. These readings are split up by a comma.
I am programming on a Linux machine and using the read() function. I have never done any serial programming. Is there a flag I can use in the read() function to read until a newline delimiter or the like. If I am on the computer and use the cat command it spits it out perfect, but when I read from the code it only outputs in proper format when I use 1 for the count parameter. I tried multiple values and none of them would give me an output like the examples above. The other way around this was created a loop to read until the comma then store as one value, then read till the newline and store as the second value. Is there a more efficient way to read from my serial device?