Microsoft KB Archive/41388

= .EXE Compiled BC /S May Not Print String in PRINT TAB(n),A$ =

Article ID: 41388

Article Last Modified on 11/21/2006



This article was previously published under Q41388



SUMMARY
Creating an executable .EXE program with QuickBasic Version 4.50 with the BC /S compiler option may cause the following statement to print a blank line: PRINT TAB(n); A$ The program works correctly from inside the QuickBasic editor, or when compiled without the /S option.

The /S option is used to minimize string data at compile time by writing quoted strings to the object file instead of the symbol table. The only use for the /S option is to help the compiler handle large programs at compile time. Normally, /S does not affect the size or behavior of the object code.

This problem can be corrected by doing the following:


 * 1) Not using the /S compiler option.
 * 2) Replacing the PRINT TAB(nn) with a PRINT SPACE$(nn) statement.
 * 3) Compiling with the /X switch, which is normally used to indicate the presence of ON ERROR with RESUME, RESUME NEXT, or RESUME 0.

This problem occurs only in QuickBasic Version 4.50; it does not occur in earlier versions of QuickBasic, Microsoft Basic Compiler 6.00 or 6.00b, or Microsoft Basic PDS Version 7.00.



Code Examples
REM ** SAMPLE PROGRAM 1 ** DOES NOT WORK CORRECTLY **

A$ = &quot;THIS SHOULD BE PRINTED&quot; PRINT TAB(40 - LEN(A$) / 2); A$ END

REM ** SAMPLE PROGRAM 2 ** WORKS FINE **

A$ = &quot;THIS SHOULD BE PRINTED&quot; PRINT SPACE$(39 - LEN(A$) / 2); A$ END

Additional query words: QuickBas BasicCom

Keywords: KB41388

-

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

© Microsoft Corporation. All rights reserved.