NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Format Specifiers

You can use format specifiers to change the display of values when you view variables or expressions in the Watch window or QuickWatch dialog box.

To use a format specifier, type the expression, followed by a comma, followed by the appropriate specifier.

Example

Suppose nVar is an integer variable, and the Watch window shows that it contains the value 0x0065. Suppose you want to see value expressed as a character instead of an integer. In the Name column, after the variable name, you would add the character format specifier, c:

nVar,c

Instead of the integer value 0x0065, the Value column now displays the character value, 'e'.

If you want to apply a format specifier to elements of an array or members of an object, you must apply it directly to each element or member. You cannot apply it to the array or object as a whole. For example, suppose you had an array nArray and wanted to see the first four elements in character format. You would enter these expressions in the Watch window:

nArray[0],c
nArray[1],c
nArray[2],c
nArray[3],c

The following tables show the format specifiers recognized by the debugger.

Specifier Format Value Displays
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 Unicode Strings setting in autoexp.dat.    
hr HRESULT or Win32 error code. (The debugger now decodes HRESULTs automatically, so this specifier is not required in those cases. It is not possible to decode HRESULTs if you compile with /noHRESULT.) 0x00000000L S_OK
wc Window class flag. 0x00000040 WC_DEFAULTCHAR
wm Windows message numbers 0x0010 WM_CLOSE

The following table contains formatting symbols used for memory locations.

Symbol Format Displays
ma 64 ASCII characters 0x0012ffac .4...0...".0W&.......1W&.0.:W..1...."..1.JO&.1.2.."..1...0y....1
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 doublewords 0x0012ffac 00CB34B3 80943084 308A22FF 00002657
mq 4 quadwords 0x0012ffac 7ffdf00000000000 5f441a790012fdd4
mu 2-byte characters (Unicode) 0x0012fc60 8478 77f4 ffff ffff 0000 0000 0000 0000

You can use a memory location specifier with any value or expression that evaluates to a location.

Format Specifiers for Unicode Strings

To display a Unicode string, use the su format specifier. To display data bytes for Unicode characters, use the mu format specifier.

Special Specifier for Strings

There is one special format specifier you can use to display a character array as a string. This specifier is ampersand (&). It is special because, unlike other specifiers, you use it as a prefix rather than a suffix and there is no comma between the specifier and the variable name:

&CharArray

See Also

Expressions in the Debugger