Hello,
I am developing an application that reads data from a serial port (on Ubuntu), and below is the relevant code used.
When I put this inside my main, it works just fine. However, if I put the exact same code inside a method, it will output weird data. I have no idea why that's so, if anyone has any guidance it would be greatly appreciated.Code:int fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY); fcntl(fd, F_SETFL, 0); int value[2]; read(fd, value, 2); printf("%x %x", value[0], value[1];
Thanks



LinkBack URL
About LinkBacks


