arun17
Mechanical
- Apr 16, 2002
- 44
Hello,
(1)I am trying to write a program for serial port communication in Linux. I have created a class in which I initiallize the port parameters using a termios structure and open the port. The class also has a function which can return a FILE pointer(using fdopen) attached with the port. This handle I am using in "main" to write to the port using "fprintf" and scan the port using "fscanf". The problem is when I send the data to one port and read it on another serial port in a fixed loop, it always skips first data in reading, however writing is ok. Two ports are connected by Null Modem cable.I am using asych. serial communication. Any clue???
(2) Another query is : I tried to open the port directly using an object from ofstream class and ifstream class.This does not work. Is there any limitation on this in Linux??
Thanks
"Knowledge is power"
(1)I am trying to write a program for serial port communication in Linux. I have created a class in which I initiallize the port parameters using a termios structure and open the port. The class also has a function which can return a FILE pointer(using fdopen) attached with the port. This handle I am using in "main" to write to the port using "fprintf" and scan the port using "fscanf". The problem is when I send the data to one port and read it on another serial port in a fixed loop, it always skips first data in reading, however writing is ok. Two ports are connected by Null Modem cable.I am using asych. serial communication. Any clue???
(2) Another query is : I tried to open the port directly using an object from ofstream class and ifstream class.This does not work. Is there any limitation on this in Linux??
Thanks
"Knowledge is power"