Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using Watch to display only portion of array

0 views
Skip to first unread message

Barry Schwarz

unread,
Aug 10, 2008, 5:52:22 PM8/10/08
to
Given an array of char inside a struct, such as

struct {long x; char y[16];} s;

is there a way to specify that I want to "watch" only the first four
characters of the array? I tried
s.y[0-4]
s.y[0:4]
with and without a leading & which produced error message CXX0034 and
s.y,4
with and without a leading & which appeared to ignore the 4 and
displayed all 16 characters.

--
Remove del for email

Alex Blekhman

unread,
Aug 11, 2008, 4:24:13 AM8/11/08
to
"Barry Schwarz" wrote:
> Given an array of char inside a struct, such as
>
> struct {long x; char y[16];} s;
>
> is there a way to specify that I want to "watch" only the first
> four characters of the array?

You can do it with this expression:

((char*)s.y), 4


HTH
Alex


Barry Schwarz

unread,
Aug 12, 2008, 12:51:28 AM8/12/08
to

Thanks but -

If I click on the "+", this will limit the expansion to four elements
but in the value column next to the variable name I still see all 16
elements

Alex Blekhman

unread,
Aug 12, 2008, 3:53:38 AM8/12/08
to
"Barry Schwarz" wrote:
> If I click on the "+", this will limit the expansion to four
> elements but in the value column next to the variable name I
> still see all 16 elements

I don't think you can change this. It is because debugger
intellisense infers an expresion type from the code.

Alex


0 new messages