If you have a statically allocated array, the Visual Studio debugger can easily display all of the array elements. However, if you have an array allocated dynamically and pointed to by a pointer, it will only display the first element of the array when you click the + to expand it. Is there an easy way to tell the debugger, show me this data as an array of type Foo and size X?
views:
2082answers:
3
+12
A:
Yes, simple. say you have
char *a = new char[10];
writing in the debugger:
a,10
would show you the content as if it were an array.
shoosh
2008-09-16 18:06:26
+3
A:
In a watch window, add a comma after the name of the array, and the amount of items you want to be displayed.
Drealmer
2008-09-16 18:06:29
A:
Try something along the lines of
(Foo[x])(*ptr)
May just work...
(My own experience with VC++ ended on VS2000, but try it anyway)
Arkadiy
2008-09-16 18:08:55