The information in this article applies to:
SUMMARY
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.
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.)
Example 1An example of this behavior can be demonstrated in the following one line code example:
If a watchpoint is set for message$ from within CodeView, the text
displayed in the Watch window for message$ will be "Hi". However, if
the variable message$ is printed as output, the displayed output will
be Hi there.
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:
This code puts "abc" starting at the fifth character position of the
variable temp. However, if you view the contents of temp within a Watch
window of CodeView, an empty string ("") will be displayed for the
string. The PRINT statement above will correctly print the contents of
temp to the screen. The PRINT statement causes a space to be printed
for each null character.
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.
Additional query words: QuickBas BasicCom 2.20 3.10 3.14 4.00 4.00b 4.50 7.00 7.10
Keywords : |
Last Reviewed: January 13, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |