Thread: com port?

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    2

    com port?

    hi, i have a problem. i want to write a small progie that reads data from a GPS Mouse. the mouse is connected to a com port and spits out the position every second. can someone tell me how to read data from a com port in c++?

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Would tend to depend on the operating system.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    2
    Originally posted by adrianxw
    Would tend to depend on the operating system.
    how about Win 2000 or NT, it's written under NT but is supposed to run under 2000.

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    You can use the CreateFile() API function, (don't worry about the name), to get a handle to a com port. Look in the help for that function with particular regard to the "Communications resources" section.

    Once you have a handle you can use any of the handle based I/O API functions to read/write/control the port. That's how I would do it.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. Segmentation Fault - Trying to access parallel port
    By tvsinesperanto in forum C Programming
    Replies: 3
    Last Post: 05-24-2006, 03:28 AM
  4. Basic port scanner code .. pls help ???
    By intruder in forum C Programming
    Replies: 18
    Last Post: 03-13-2003, 08:47 AM
  5. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM