Thread: library question

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    8

    library question

    hello! i downloaded codeplug's code in the thread:

    http://cboard.cprogramming.com/showthread.php?t=47870

    and tried to compile it. but when i executed it, all i get is a black screen.

    i tried to replace the port value ith the available ports i have (1,5, & 6), but i still get the black screen. anyone know what's wrong with it?

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Ask codeplug.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> ...but i still get the black screen
    Is anything being sent to COM5 at 9600, "8N1"? If not, then all you should see is a black screen.

    What device are you trying to comunicate with?

    gg

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    8

    i posted the wrong port.cpp file

    sorry! i misplaced the actual code i used. the actual code is attached below.

    i'm trying to communicate with com port 2. i have 2 Sfile objects (sf & sf2). sf writes a string into com 2 and sf2 is reading the previously entered string from com 2. please tell me what is wrong with my code.

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    * Open both ports at the same time. The Open() method purges the port.
    * Check for failure of the Read() and Write() methods.
    * Use a NULL-Modem cable to connect the ports.

    If you still having problems then you probably have a cheap UART chip on your motherboard. Some UART chips that drive multiple COM ports don't work when the ports are talking to each other with a NULL-Modem cable.

    gg

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    8

    thanks!

    thanks for the suggestions! i think i understand it better now. i hope you don't mind, but i have question (i promise this is the last ).


    for example , i am writing a string to the port. so i write

    DWORD d;
    Write(str, sizeof(str), d ).

    is this right? or do i change something? i am not too sure what should be the value of the third parameter.

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    The last parameter is an output parameter that receives the number of bytes actually written. If Write() returns TRUE, then it's safe to assume that it wrote as many bytes as you told it to (the second paramter).

    I wrote that code back in '97. It's probably time for an overhaul.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's an import library?
    By chiefmonkey in forum C++ Programming
    Replies: 1
    Last Post: 06-19-2009, 05:00 PM
  2. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  3. static data structure in a library
    By melight in forum C Programming
    Replies: 6
    Last Post: 01-10-2009, 11:12 AM
  4. Question about binary trees and files
    By satory in forum C Programming
    Replies: 9
    Last Post: 03-06-2006, 06:28 AM
  5. Replies: 19
    Last Post: 01-12-2006, 11:04 AM