tags:

views:

539

answers:

7

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??

A: 

Have you looked into modifying the autoexp.dat file? You may be able to tweak some values in there. For more information:

Thomi
A: 

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.

Doug T.
+1  A: 

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.

nruessmann
The cast won't work, since the problem is that VC6 truncates strings in the watch window. e.g. your post would show up as "I do not have..." with no way to get the rest of the string short of opening the memory window.The the VC2008 express idea should work.
Eclipse
+2  A: 

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.

gbjbaanb
This is the method I now use, but I would add a caveat for others: when you paste as text and edit, you need to consider the possibility of embedded nulls that truncate the string but are converted to non-printable characters. These, combined with 'junk' in memory can make a string appear to be longer than it really is.
William Knight
A: 

Perhaps, get used to creating logfiles, and write output into the file directly, then bring up in your favorite text editor.

A: 

The only technique i have seen is to watch the string then the string + 50, + 100 etc.

Eugene Ivakhiv wrote an addin for msvc 6 that lets you display the full string in an edit box.

EvilTeach
A: 

There's a cute plugin for VC6 called XDebug. It adds a dialog for viewing different types of strings. It worked great for me.

Humanier