I know this has probably been asked before but for my problem I cannot find a solution.
I need a function receive(int recv) that I call in a loop and that receives one Byte.
I have set up my serial port so far (termios.h) and am able to receive using read()
However I can only receive the whole buffer of the port. So read(fd, recv, 255); always returns multiple bytes.
What I would need is a Buffer in which I receive bytes and when receive(int recv) is called it always gives the first byte of this buffer.
How would such a buffer look like? I would gladly appreciate any help on this one!
Thanks!
0
votes
ssize_t read(int fd, void *buf, size_t count)withint recvas the second parameter, which is badly wrong. - Philip Kendall