Microsoft KB Archive/42329

= PRINT SPC(80) Statement May Not Wrap to the Next Line =

Article ID: 42329

Article Last Modified on 11/21/2006



This article was previously published under Q42329



SUMMARY
In Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50, Microsoft Basic Compiler Versions 6.00 and 6.00b, and Microsoft Basic PDS Version 7.00, the SPC function does not cause output to wrap around to the next line(s). In QuickBasic Version 3.00, the SPC function wraps to the next line.

For comparison, the SPACE$ function wraps to the next line in all versions.

The nonwrapping behavior of the SPC function is an intentional feature in QuickBasic Versions 4.00, 4.00b, and 4.50, Basic compiler Versions 6.00 and 6.00b, and Microsoft Basic PDS Version 7.00. If the value given to the SPC function is greater than the defined screen width, the spacing will be: MOD. For example, the following line would actually print &quot;Hello&quot; in column 3 of the same line: PRINT SPC(83);&quot;Hello&quot; The documentation on this function is incomplete and will be corrected. Microsoft will post new information here as it becomes available.

In the following code example, both outputs will incorrectly be on the same line: REM *** SPC problem example *** CLS : LOCATE 1,1 : PRINT &quot;          XXX&quot; LOCATE 1,1 : PRINT SPC(80); &quot;Hello&quot;; END The SPC(80) function should force the &quot;Hello&quot; literal to be displayed on the second line. The SPACE$ function can be used to simulate the line wrap, when given the space (Hex 20) character. Note that the SPACE$ function overwrites any screen information that comes in its path with the new SPACE$ character.

Additional query words: QuickBas BasicCom

Keywords: KB42329

-

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

© Microsoft Corporation. All rights reserved.