Character Formatting of Watch Variables

The following table shows how you can change the display format of variables in the QuickWatch dialog box or in the Watch window by using formatting characters.

Character Format Value Display
d,i Signed decimal integer 0xF000F065 -268373915
u Unsigned decimal integer 0x0065 101
o Unsigned octal integer 0xF065 0170145
x,X Hexadecimal integer 61541 (decimal) 0x0000F065
l,h Long or short prefix for: d, i, u, o, x, X 00406042,hx 0x0c22
f Signed floating-point 3./2. 1.500000
e Signed scientific notation 3./2. 1.500000e+000
g Signed floating-point or signed scientific notation, whichever is shorter 3./2. 1.5
c Single character 0x0065 'e'
s String 0x0012fde8 "Hello world"
su Unicode string   "Hello world"
st Unicode string or ANSI string, depending on the Unicode Strings setting in Autoexp.dat    
hr HRESULT or Win32 error code 0x00000000L S_OK
wc Window class flag 0x00000040 WC_DEFAULTCHAR
wm Windows message numbers 0x0010 WM_CLOSE

To use a formatting character, type the variable name, followed by a comma and the appropriate character. For example, if var has a value of 0x0065, and you want to see the value in character form, type var,c in the Name column on the tab of the Watch window. When you press ENTER, the character-format value appears. For example:

var,c = 'e'

The following table shows the formatting characters that you can use to format the contents of memory locations.

Character Format Display
ma 64 ASCII characters 0x0012ffac .4...0...".0W&.......1W&.0.:W..1...."..1.JO&.1.2.."..1...0y....1 m
m 16 bytes in hexadecimal, followed by 16 ASCII characters 0x0012ffac B3 34 CB 00 84 30 94 80 FF 22 8A 30 57 26 00 00 .4...0...".0W&..
mb 16 bytes in hexadecimal, followed by 16 ASCII characters 0x0012ffac B3 34 CB 00 84 30 94 80 FF 22 8A 30 57 26 00 00 .4...0...".0W&..
mw 8 words 0x0012ffac 34B3 00CB 3084 8094 22FF 308A 2657 0000
md 4 double words 0x0012ffac 00CB34B3 80943084 308A22FF 00002657
mq 4 quad words 0x0012ffac 7ffdf00000000000 5f441a790012fdd4
mu 2-byte characters (Unicode) 0x0012fc60 8478 77f4 ffff ffff 0000 0000 0000 0000

With the memory location formatting characters, you can type any value or expression that evaluates to a location.

To display the value of a character array as a string, precede the array name with an ampersand (&), such as in the following example.

&yourname

A formatting character can also follow an expression, such as in the following example.

rep+1,x
alps[0],mb
xloc,g
count,d

To watch the value at an address or the value that is pointed to by a register, use the BY, WO, or DW operator:

  • BY returns the contents of the byte that is pointed to.
  • WO returns the contents of the word that is pointed to.
  • DW returns the contents of the DWORD that is pointed to.

Follow the operator with a variable, register, or constant. If the BY, WO, or DW operator is followed by a variable, the environment watches the byte, word, or DWORD at the address that is contained in the variable.

You can also use the context operator to display the contents of any location. The context operator qualifies the variable and is a pair of braces ({}) containing two commas, and a combination of function name, source file name, and executable file name. For example:

{[function],[source],[exe] } variable name

If you omit either the function name or the executable file name, the two commas cannot be omitted.

The following syntax, for example, is illegal.

{File.c, File.exe} variable1

If you omit both the source file name and the executable file name, however, you can omit the commas. The following syntax is legal.

{Function1} variable1

To display a Unicode string in the Watch window or the QuickWatch dialog box, use the su format specifier. To display data bytes with Unicode characters in the Watch window or the QuickWatch dialog box, use the mu format specifier.

You can apply formatting characters to structures, arrays, pointers, and objects as unexpanded variables only. If you expand the variable, the specified formatting affects all members. You cannot apply formatting characters to expanded variables.

See Also

Debug Information Viewing | Variable and Expression Watching

 Last updated on Friday, October 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.