Viewing strings in the Visual C++ 6.0 Debugger
Posted on 2003-03-06
Here's the relevant information...
LPOLESTR pwszTarget = NULL;
// @@@ ======= TEST =======
pwszTarget = (LPOLESTR) CoTaskMemAlloc(
(ustrlen(" Filename.EXT") + 1)
hr = E_OUTOFMEMORY, throw HRException();
ustrcpy(pwszTarget, OLESTR(" Filename.EXT"));
// @@@ ======= END =======
Now my problem is this:
I have absolutely no idea what I'm doing in Visual C++, yet the project that I am currently working on requires that I make things work. In the snippet above, I am attempting to allocate space for 'pwszTarget', then load a constant string into it.
I have made the following assumptions:
- Memory must be allocated before the copy of the string to 'pwszTarget'
- OLESTR() is used because that's the way everything else that I've seen is done
- It isn't working
I mention that last assumption because I'm not even sure if it *isn't* working. This brings up the second part of my question, how do I view a string in the debugger for Visual C++ 6.0?
This is what I'm seeing in the watch window with a few variations on how the variable is displayed...
&pwszTarget 0x0012eaa8 "Ð¯"
(char *)(pwszTarget) 0x0017afd0 " "