Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serial port handling in linux

Status
Not open for further replies.

arun17

Mechanical
Apr 16, 2002
44
0
0
IN
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"
 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top