I'm in lua ffi trying to read all the bytes from the serial port with read from C However, the pointer to the buffer moves as it reads ( buf = buf + n ). As a result, I only get the last read in the buffer.
As I understand it, you need to create another pointer to the buffer. But how to do that?