const WCHAR* nodeval;

if (FAILED(hr = pReader->GetValue((LPCWSTR *)&nodeval, NULL)))

{

wprintf(L"Error getting value, error is %08.8lx", hr);

return -1;

}



When I try debugging the const WCHAR* datavariable in the locals
screen, I keep getting a <Bad Ptr> displayed as the Value. How
exactly does the const WCHAR * work and how do I know if that pReader-
>GetValue function is actually setting nodeval correctly?





Thanks

Re: const WCHAR * by Mark

Mark
Tue Jul 24 13:44:55 CDT 2007

nodeval is uninitialized so it will remain invalid until the GetValue() call
succeeds.

Why did you need the cast in the GetValue() call?

Mark

--
Mark Salsbery
Microsoft MVP - Visual C++

<a7zulu@gmail.com> wrote in message
news:1185301666.708833.264840@57g2000hsv.googlegroups.com...
> const WCHAR* nodeval;
>
> if (FAILED(hr = pReader->GetValue((LPCWSTR *)&nodeval, NULL)))
>
> {
>
> wprintf(L"Error getting value, error is %08.8lx", hr);
>
> return -1;
>
> }
>
>
>
> When I try debugging the const WCHAR* datavariable in the locals
> screen, I keep getting a <Bad Ptr> displayed as the Value. How
> exactly does the const WCHAR * work and how do I know if that pReader-
>>GetValue function is actually setting nodeval correctly?
>
>
>
>
>
> Thanks
>