Thread: Need help on using C++ programming on serial port

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    29

    Exclamation Need help on using C++ programming on serial port

    I am working on a project which requires to send and recieve data from the serial port COM1. I tried various ways but to no vain...
    I tried funcitons like bioscom(), inport(), outport() to set the status, read data and send data. When I tried compling, it gives an error saying undefine error to these functions.

    Could someone guide me to my destiny...
    Could someone show me where to get the functions for the serial communications..??

    Thanks a million!

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    12
    try here

    [link]http://www.traverse.com/people/poinsett/bcbcomm.html[/link]


    I searched for "Serial port header file c++" at google and this was the top of the list


    ... Had a look.. it uses serial port to send and recieve chars... so it should help.

    .. hope it does!
    [D3T]
    Borland Turbo C++ 3.0 For Dos

    *
    do { war(); } while (nations == hostile);

    ... The best way to prevent wars is to have them.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    If you're looking for something, why not try a board search first?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    29

    Searched but maybe don't quite understand..

    Yup i had searched the google with lots of combinations...
    The website that D3t posted, i had visited.
    The vc1.h header include in the program was not found on my directory and was wondering what its use for.
    Also found out that there maybe a need to use WIN32 API, searched the web couldn't understand what was WIN32 API...
    Is it a programmming language or some functions. If its functions what header does it needs...

    I had spent sometime going through this board before i post the question. Entered 'serial' to search for postings relating to serial for some results, but they used the functions besides the inport(), outport() they use something called createFile() to open the port. I tried using that but couldn't complie(think it needs a header)

    Therefore i need to have some guidance on that!
    Thanks for the Help D3T and Hammer

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    12
    you CAN do it because i have seen a stepper motor control porgram written in C++ [soz couldnt leech 4 u ], and also PHP - which i believe is like macros that do certain things in c++ you can do $fo = fopen('COM1:' r+);

    IT MUST BE POSSIBLE!!

    [EDIT] You could try that... try ofstreaming COM1: or COME2: (maybe no : after) and then try writing to it...? you may need sommat connected to the other end so that it doesnt returen dodgy errors...
    Last edited by D3T; 07-09-2002 at 05:52 AM.
    [D3T]
    Borland Turbo C++ 3.0 For Dos

    *
    do { war(); } while (nations == hostile);

    ... The best way to prevent wars is to have them.

  6. #6
    Registered User
    Join Date
    Jul 2002
    Posts
    29
    Hmm...nevermind, i found another way using win32 API
    hehe thanks for the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. serial port to poll on request
    By infineonintern in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 06:52 AM
  2. Can't Read From Serial Port
    By HalNineThousand in forum Linux Programming
    Replies: 14
    Last Post: 03-20-2008, 05:56 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Reading and writing to a serial port
    By SwarfEye in forum C Programming
    Replies: 2
    Last Post: 08-18-2006, 12:28 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