Article ID: 75613 - Last Review: August 16, 2005 - Revision: 2.3 In CodeView, Strings Not Watchable Beyond Null (0) CharacterThis article was previously published under Q75613 On This PageSUMMARY
This article documents a limitation of Microsoft CodeView's Watch
feature when viewing Basic string expressions. A fixed-length or
variable-length string containing a null character is only watchable
up to the null character under CodeView. Any text beyond the null
character is not watchable. This is not a problem with CodeView, but
rather a design limitation.
This information applies to Microsoft CodeView versions 2.2 and 3.1 for MS-DOS and MS OS/2; Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS and version 7.1 for MS OS/2; and Microsoft QuickBasic versions 4.0, 4.0b, 4.5 for MS-DOS. (Note: CodeView is not shipped with QuickBasic 4.x products). MORE INFORMATION
A null character is a byte with an ASCII value of 0, such as returned
by the Basic function CHR$(0). (Note that null bytes serve as the
standard string terminator in the Microsoft C language.)
CodeView interprets a null character as a null terminator for a string. Any attempt to display a string expression containing null characters in the Watch window of CodeView will result in a display of the string truncated at the null character. For example, if a null character is the first character of a string, an empty string ("") will be displayed in the Watch window for the string. Example 1An example of this behavior can be demonstrated in the following one line code example:Example 2In the following example for fixed-length strings, CodeView will not display any text:
The following is a code example that demonstrates the behavior described above: One workaround for this behavior is to assign an empty string ("") to the fixed-length string variable. The assignment should be made after the DIM statement and before the MID$ statement. When a fixed-length string is assigned to an empty string, all null characters are replaced by spaces (ASCII 32). If a Watchpoint is set on temp in the following code example, the full contents of the string will be displayed in the Watch window. APPLIES TO
| Article Translations
|
Back to the top
