Microsoft KB Archive/36576

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


CTRL+Z Embedded in Source Truncates BC.EXE Compilation

Article ID: 36576

Article Last Modified on 8/16/2005



APPLIES TO

  • Microsoft Visual Basic for MS-DOS
  • Microsoft QuickBasic 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBasic 4.5 for MS-DOS
  • Microsoft BASIC Professional Development System 7.0
  • Microsoft BASIC Professional Development System 7.1
  • Microsoft BASIC Compiler 6.0
  • Microsoft BASIC Compiler 6.0b



This article was previously published under Q36576

SUMMARY

The QB.EXE editor allows you to embed control characters into a source file by pressing CTRL+P followed by CTRL+<desired key>. This information is documented in a table on Page 135 of the "Microsoft QuickBasic 4.0: Learning and Using" manual for versions 4.0 and 4.0b, and on Page 204 of the "Microsoft QuickBasic 4.5: Learning to Use" manual for version 4.5.

When using this technique, do not type CTRL+Z into the source file if the file is saved as text. For a file saved as text, CTRL+Z marks the end of the file (EOF) for BC.EXE and other Microsoft compilers. (This feature is a carryover from the end-of-file standard required for text files in MS-DOS versions 1.x.) You must save in fast load format for BC.EXE to accept embedded CTRL+Z characters.

A CTRL+Z byte appears on the screen as a right-arrow symbol. To print a right-arrow symbol on the screen, use the statement PRINT CHR$(26) instead of embedding a CTRL+Z in a string constant.

MORE INFORMATION

BC.EXE stops compiling text source files when it reaches a CTRL+Z (ASCII value 26) byte. The program below demonstrates this behavior and terminates BC.EXE with a "Label Not Defined" error message.

GOSUB lab
PRINT "Here is a right-arrow character:"
PRINT "[Press CTRL+P followed by CTRL+Z here in the QB.EXE 4.00 editor.]"
END
lab: PRINT "Test"
RETURN
                

The following equivalent program compiles successfully in BC.EXE:

GOSUB lab
PRINT "Here is a right-arrow character:"
PRINT CHR$(26)
END
lab: PRINT "Test"
RETURN
                


Additional query words: VBmsdos QuickBas BasicCom 1.00 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10

Keywords: KB36576