how to watch the content which is pointed by a pointer
-
I am coding under vc 6.0 every time I debug, I find that if a list is pointed by the pointer, I can only see the first content of the list in the watch window, any ideas how to watch all the list ? PS. some say we can see them in a memory window but it is too hard to read. some say I can indicate the specific index of the list ,say list[5], but I want to see all the content in a list.
-
I am coding under vc 6.0 every time I debug, I find that if a list is pointed by the pointer, I can only see the first content of the list in the watch window, any ideas how to watch all the list ? PS. some say we can see them in a memory window but it is too hard to read. some say I can indicate the specific index of the list ,say list[5], but I want to see all the content in a list.
a pointer is only an address in memory. if you handle an array, you actually use a pointer to the 1st element. the VC6 debugger is not very powerful (actually, VC6 itself is far outdated by its new versions). so if you want to see the other elements, you have to specify yourself the address of the element you need to watch AFAIK...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
I am coding under vc 6.0 every time I debug, I find that if a list is pointed by the pointer, I can only see the first content of the list in the watch window, any ideas how to watch all the list ? PS. some say we can see them in a memory window but it is too hard to read. some say I can indicate the specific index of the list ,say list[5], but I want to see all the content in a list.
I think in VC6, you can type something like: 'list,m' in the watch window This will show you the entire memory. VS2003, 2005, 2008 supports this.
God bless, Ernest Laurentin
-
a pointer is only an address in memory. if you handle an array, you actually use a pointer to the 1st element. the VC6 debugger is not very powerful (actually, VC6 itself is far outdated by its new versions). so if you want to see the other elements, you have to specify yourself the address of the element you need to watch AFAIK...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
toxcct wrote:
the VC6 debugger is not very powerful (actually, VC6 itself is far outdated by its new versions). so if you want to see the other elements, you have to specify yourself the address of the element you need to watch AFAIK...
you are correct, But viewing the List items is very simple from VC6.0, we don't want to explicitly specify the address of the next element, it shows tree view in the watch window and expands the list if the first element is in the watch window.
struct ListNode
{
int iData;
struct ListNode *pNext;
};int main(int argc, char* argv[])
{struct ListNode Head, Middle, Tail; Head.pNext = &Middle; Middle.pNext = &Tail; Tail.pNext = 0; return 0;
}
I can view the list items in the above program as tree view in the watch window of VC6.0, even VC6.0 supports drag and drop variable to watch window.
-
toxcct wrote:
the VC6 debugger is not very powerful (actually, VC6 itself is far outdated by its new versions). so if you want to see the other elements, you have to specify yourself the address of the element you need to watch AFAIK...
you are correct, But viewing the List items is very simple from VC6.0, we don't want to explicitly specify the address of the next element, it shows tree view in the watch window and expands the list if the first element is in the watch window.
struct ListNode
{
int iData;
struct ListNode *pNext;
};int main(int argc, char* argv[])
{struct ListNode Head, Middle, Tail; Head.pNext = &Middle; Middle.pNext = &Tail; Tail.pNext = 0; return 0;
}
I can view the list items in the above program as tree view in the watch window of VC6.0, even VC6.0 supports drag and drop variable to watch window.
I know what is a linked list, but I don't think the OP is using them at all. hence my reply, refering to arrays and pointer arithmetic. I think he used the term "list" when he wanted to say "array"...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
I know what is a linked list, but I don't think the OP is using them at all. hence my reply, refering to arrays and pointer arithmetic. I think he used the term "list" when he wanted to say "array"...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
toxcct wrote:
I think he used the term "list" when he wanted to say "array"...
struct ListNode list[3]; struct ListNode *plist = list; still i can view as tree control of array element with tree labels like [0], [1], [2] .. in VC6.0 watch window when watching variable as "list" and "plist,3"
-
I think in VC6, you can type something like: 'list,m' in the watch window This will show you the entire memory. VS2003, 2005, 2008 supports this.
God bless, Ernest Laurentin