Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

How should I do to work with Serial Port?

Status
Not open for further replies.

Denyson

Programmer
Mar 20, 2001
19
BR
Hi,

What the steps to work with serial port in C++. I have to send and receive some data using COM 1.

Thanks
Denyson
 
Using the serial port is a bit interesting, but not terribly difficult once you understand how it works. If you just want a drop in solution, there are C++ classes for the serial port that are freely available on the web. As to the details...you create a file using CreateFile, use the file handle returned to set up the details of communication (baud rate, handshaking, etc.) with SetCommState (and SetCommTimeouts) then use WriteFile and ReadFile to retrieve the data from the port.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top