Microsoft KB Archive/26605

= BC.EXE &quot;Line Too Long&quot; for Source Lines of 256+ Characters =

Article ID: 26605

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q26605



SUMMARY
The program below, which has a 263-character-long CONST statement in one line, runs without error when loaded in the QB.EXE or QBX.EXE environment, but gives a &quot;Line too long&quot; error when compiled with the BC.EXE compiler.

A blank line filled with 256 or more space characters (ASCII byte value 32) also gives a &quot;Line too long&quot; error at compile time with BC.EXE. This is difficult to see, unless you put the cursor on the blank line and press the END key to move the cursor to the actual end of the line. The column status indicator in the lower-right corner of the QB.EXE or QBX.EXE environment then shows the number of characters in that line.

The &quot;Line too long&quot; error occurs by design in both cases above because the BC.EXE compiler restricts line length to 255 characters, which includes the CR (carriage return), LF (linefeed), and the underscore (_) line-continuation character. (Note that the QBX.EXE editor automatically removes the underscore character and concatenates the continued lines; other editors will keep the underscore.)



MORE INFORMATION
The QB.EXE and QBX.EXE editors initially prevent you from typing a line past column 255, but if you move the cursor to a different line, then back, the editors let you add characters past column 255. Despite this capability, you should not type lines that exceed 255 characters. You can easily check the number of characters in any line by placing the cursor on the line in question, pressing the END key, and looking at the column counter on the lower-right corner of the screen in the QB.EXE or QBX.EXE environment.

Code Example
BC.EXE compiles this program correctly if you remove one character to make the CONST line 262 characters long. Normally, the line limit is 255 characters, but CONST statements are parsed differently than other lines of code, giving you seven additional characters of leeway in this case. ' The following CONST line (where you should type all 263 characters ' on one line to demonstrate the &quot;Line too long&quot; error in BC.EXE) ' can be typed past column 255 in QB.EXE or QBX.EXE if you press the ' DOWN ARROW then the UP ARROW back onto the long line, and ' continue typing: CONST A$ = &quot;12345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890&quot;

PRINT A$

Additional query words: QuickBas BasicCom 4.00 4.00b 4.50 7.00

Keywords: KB26605

-

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

© Microsoft Corporation. All rights reserved.