simple c++ question

Thread Starter

PRS

Joined Aug 24, 2008
989
I recently bought a USB to serial port, but I am only just learning c++ in order to use it for a digital electronics project. I need to be able to output and input numbers. The name the installer called the port was COM4

How do I write a number to it?
How do I read a number from it?

I will sure appreciate any help.
 

Thread Starter

PRS

Joined Aug 24, 2008
989
I'll add today that I have explored the problem on the net and it is not very simple. Microsoft has a good answer at its site.
 

cheezewizz

Joined Apr 16, 2009
82
I don't know, in comparison to coding stuff to use USB it's far easier. I take it you found what you were after on MSDN? If not all you need to look up is CreateFile, GetCommTimeouts, SetCommTimeouts, GetCommState, SetCommState (for the COM port setup) and then ReadFile and WriteFile for sending/receiving data...
 
Top