simple c++ question

Discussion in 'Computing and Networks' started by PRS, Aug 1, 2010.

  1. PRS

    Thread Starter Well-Known Member

    Aug 24, 2008
    989
    35
    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.
     
  2. PRS

    Thread Starter Well-Known Member

    Aug 24, 2008
    989
    35
    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.
     
  3. cheezewizz

    Active Member

    Apr 16, 2009
    82
    10
    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...
     
  4. PRS

    Thread Starter Well-Known Member

    Aug 24, 2008
    989
    35
    Thank's. I'm looking into USB ports.
     
Loading...