Thread: possible reasons wstring is out of sync with _Bx?

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    188

    possible reasons wstring is out of sync with _Bx?

    hey guys, i'm running into an extremely weird problem.

    i'm using VS2003.NET if that matters.

    here are some relevant data structures being used, almost verbatim:
    Code:
    struct A
    {
      std::wstring Begin;
      std::wstring End;
    };
    
    std::wstring TrimSpace(const std::wstring& value);
    
    void SomeMethod()
    {
      // read from database into a Row using OLEDB
      A a;
      a.Begin = TrimSpace(row.Begin); // succeeds
      a.End = TrimSpace(row.End); // sometimes fails
    }
    what i mean when i say it fails is that in the debugger, the value of a.End will show some messed up character (non-ascii) or ???. however, if i expand the value of the string in the debugger, the buffer (usually _Bx or _Buf) will show the correct value from row.End.

    why is the wstring not getting the correct value stored? thanks.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    As you say, it gets it stored, just not displayed by the debugger. That's a bug in the debugger's wstring visualization, nothing else.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    188
    yes, that is the problem. thanks. btw, there's a solution here for those interested:
    http://support.microsoft.com/kb/326616

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading a language file (UTF-8 to wstring)
    By EVOEx in forum C++ Programming
    Replies: 2
    Last Post: 10-27-2008, 09:45 AM
  2. making a wstring variable global scope
    By stanlvw in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2008, 02:25 PM
  3. Sync Process A and B with Semaphore
    By Ti22 in forum Linux Programming
    Replies: 6
    Last Post: 11-29-2004, 05:35 PM
  4. Sync Probs Networking An RTS
    By MicroFiend in forum Networking/Device Communication
    Replies: 17
    Last Post: 10-22-2004, 07:56 AM
  5. srand()... possible reasons for failure
    By lightatdawn in forum C++ Programming
    Replies: 3
    Last Post: 12-18-2001, 02:33 AM