Thread: Displaying an array value as text in windows

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    27

    Displaying an array value as text in windows

    Hi all,
    I'm having a bit of trouble checking that my program is working properly. I have defined a list of objects in an object array called "LineArray". One of the data members of these objects is an array to hold sets of random numbers called "m_XYCoOrds". What I want to do is to check that each object has different numbers in their own arrays.

    In the view.cpp file the OnDraw function looks like this:

    void CLinesView::OnDraw(CDC* pDC)
    {
    CLinesDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    // TODO: add draw code for native data here


    pDC->TextOut(60,60,pDoc->LineArray[1].m_XYCoOrds[0][1]);
    pDC->TextOut(60,80,pDoc->LineArray[1].m_XYCoOrds[0][2]);


    }

    All that it ever gives me is the value I(1?) I do know that the co-ordinates are different because it can draw a line quite nicely. I think that i'm probably just using the wrong function to display the text. Any help would be greatly appreciated.
    Cheers
    Dylan

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You are using TextOut() incorrectly (unless m_XYCoOrds is a matrix of char*'s or CString's).

    You need ot convert m_XYCoOrds[0][1] and [2] into a C-string or CString to pass into TextOut().

    gg

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    27

    okay

    Thanks, that will clear it up.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Displaying Text on MDI child windows
    By EmbeddedC in forum Windows Programming
    Replies: 4
    Last Post: 10-30-2008, 12:28 PM
  2. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  3. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  4. Merge sort please
    By vasanth in forum C Programming
    Replies: 2
    Last Post: 11-09-2003, 12:09 PM
  5. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM