Accessing Ports

This is a discussion on Accessing Ports within the C Programming forums, part of the General Programming Boards category; Hi all. Here is my problem. I am trying to write a program that recieves text from a serial port ...

  1. #1
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

    Question Accessing Ports

    Hi all. Here is my problem. I am trying to write a program that recieves text from a serial port (Comm 1 or Comm 2) and write them to a text file.
    The trouble I'm running into is accessing the serial port itself. I looked up the comm ports and found there port ranges. Each has a range of 8 ports.
    Anyone know which port the data is recieved and on which port the data is sent?
    Once I can interface the ports I can easily send the data to the file.
    Thanks for your time.

    Mike

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Borland Turbo C Version 2.01
    Windows 98

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    You can open a serial port for reading and writing with the CreateFile() API function.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Thanks for the help. I'm not fimilar with CreateFile(). What would the syntax be?

    Thanks

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,663
    > CreateFile() API function.
    That's a windows API function isn't it?

    Thantos is using the oldest of the old DOS compiler

    I think it's called bioscom in bios.h - well it is here in DJGPP, but
    you might have to look around.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Thanks Salem.
    I noticed you refered to my compiler as the oldest of old. I guess I'd have to agree with that. I got it from my uncle about 10 years ago and he had it awhile. Do you know of a good C compiler that is doesn't cost a whole lot?

  7. #7
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    Dev-C++ is a good, free Windows compiler.

    DJGPP is a good, free DOS compiler.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Listen at several ports at the same time
    By Atlantico in forum Networking/Device Communication
    Replies: 5
    Last Post: 03-03-2009, 01:37 AM
  2. virtual ports
    By royuco77 in forum Networking/Device Communication
    Replies: 5
    Last Post: 07-02-2005, 10:33 AM
  3. Control of ports
    By Blip in forum Networking/Device Communication
    Replies: 1
    Last Post: 05-02-2005, 09:04 AM
  4. Controlling ports
    By lockpatrick in forum Linux Programming
    Replies: 2
    Last Post: 06-09-2002, 11:58 AM
  5. Need a hand accessing the serial ports
    By Danwood13 in forum C++ Programming
    Replies: 3
    Last Post: 04-24-2002, 10:03 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21