Microsoft KB Archive/60131

= Problem with MID$ Statement and MID$ Function in QBX.EXE =

Article ID: 60131

Article Last Modified on 11/21/2006



This article was previously published under Q60131



SYMPTOMS
Using the MID$ function as an argument of the MID$ statement can produce incorrect results in the QBX.EXE environment and in .EXE programs compiled with the far strings option (BC /Fs) in Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1, as shown in the program below.

The problem does not occur when compiled with near strings (the default) in the BC.EXE environment of Basic PDS 7.0 and 7.1; with the BC.EXE or QB.EXE environment of Microsoft QuickBasic version 4.0, 4.0b, or 4.5 (which have no far strings option); or with the BC.EXE or QB.EXE environment of Microsoft Basic Compiler versions 6.0 and 6.0b (which have no far strings option).



STATUS
Microsoft has confirmed this to be a bug when using far variable-length strings in Microsoft Basic PDS versions 7.0 and 7.1. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
Note that the far strings option (BC /Fs) only affects variable-length string variables, and does not affect fixed-length string variables.

The program below should correctly output &quot;1212345678&quot;. However, when run from within the QBX.EXE environment (which always uses far strings), it incorrectly outputs &quot;1212121212&quot;. This behavior also occurs if a length% argument of 10 is used in the MID$ function. If 8 or 9 is used as the length% argument of the MID$ function, the correct output is produced. If the start% argument of the MID$ function is not taken to be 1, correct output displays.

Code Example
A$= &quot;1234567890&quot; MID$(A$, 3) = MID$(A$, 1) PRINT A$ NOTE: The first MID$ occurrence above is the MID$ statement, and the second occurrence is the MID$ function.

Additional query words: BasicCom buglist7.00 buglist7.10 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10

Keywords: KB60131

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.