Thread: TCHAR* passing

  1. #1
    Registered User
    Join Date
    Oct 2007

    TCHAR* passing

    I call a function AreaName() which returns a TCHAR*. The problem is the return value is garbage - squares and Chinese characters. The function t.Areaname() comes from a static library. I checked the memory address AreaName points to on both sides and that is the same value. I think this must be a Unicode error, but since I'm using the same type, I'm a not sure what I should try. Thank you in advance -Patrick

    //my code
    const TCHAR* AreaName; //should be something like "Denver"
    AreaName = t.AreaName(); //garbage comes back 
    //this compiles into a library 
    virtual const TCHAR* AreaName() const			
    return m_EffectLoc.m_Area.m_AreaName;  //Using the debugger I can see this data is good
    struct AreaT
    TCHAR m_AreaName[STR_SIZE_64];

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    How are you printing it?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. passing struct vs. reference
    By reakinator in forum C Programming
    Replies: 4
    Last Post: 06-14-2008, 10:11 PM
  2. Newb Question on Passing Objects as Parameters
    By Mariano L Gappa in forum C++ Programming
    Replies: 12
    Last Post: 11-29-2006, 01:08 PM
  3. Passing by reference not always the best
    By franziss in forum C++ Programming
    Replies: 3
    Last Post: 10-26-2005, 07:08 PM
  4. Compiler "Warnings"
    By Jeremy G in forum A Brief History of
    Replies: 24
    Last Post: 04-24-2005, 01:09 PM
  5. passing by address vs passing by reference
    By lambs4 in forum C++ Programming
    Replies: 16
    Last Post: 01-09-2003, 01:25 AM