Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get full string value of variable in VC6 watch window?

I'm wanting to get the full value of a char[] variable in the VC6 watch window, but it only shows a truncated version. I can copy the value from a debug memory window, but that contains mixed lines of hex and string values. Surely there is a better way??

like image 307
William Knight Avatar asked Sep 19 '08 17:09

William Knight


People also ask

How do you view the value of a variable?

Hover over a variable to see its value. The most commonly used way to look at variables is the DataTip. When stopped in the debugger hover the mouse cursor over the variable you want to look at.

How can I change variable value while debugging in Visual Studio?

Solution 3Set a break point where your variable is used and start debugging. When execution stops at the break point, change the content of your variable in the local window and resume execution by pressing F5.


3 Answers

For large strings, you're pretty much stuck with the memory window - the tooltip would truncate eventually.

Fortunately, the memory window is easy to get data from - I tend to show it in 8-byte chunks so its easy to manage, find your string data and cut&paste the lot into a blank window, then use alt+drag to select columns and delete the hex values. Then start at the bottom of the string and continually page up/delete (the newline) to build your string (I use a macro for that bit).

I don't think there's any better way once you get long strings.

like image 70
gbjbaanb Avatar answered Oct 26 '22 09:10

gbjbaanb


Push come to shove you can put in the watch

given

char bigArray[1000];

watch:

&bigArray[0]
&bigArray[100]
&bigArray[200]
...

or change the index for where in the string you want to look...

Its clunky, but its worked for me in the past.

like image 24
Doug T. Avatar answered Oct 26 '22 07:10

Doug T.


I do not have VC6 any more, so I cannot try it. I do not know if it works, but maybe you can enter

(char*)textArray;

in the watch window.

The bettter solution maybe: VS2008 automatically displays the text the way you want. And there is a Express Edition for VS2008 free of change, which can, as far as I know, be used to develop commerecial applications. You can even try to continue developing with VC6, and use VS2008 for debugging only. With VS2003 it was possible. About 5 year ago I had to maintain an app which was developed with VC6. I kept using VC6 for developing, but for debugging I used VS2003.

like image 45
nruessmann Avatar answered Oct 26 '22 08:10

nruessmann