NAME

$include - include a BASIC source file

SYNOPSIS

rem $include: ’FileSpec
’ $include: ’FileSpec

DESCRIPTION

The $include metacommand appears in the program as part of a remark, either after the rem keyword or after a single quote.  Characters following a $include metacommand are ignored.  FileSpec is the file specification (which must be enclosed in single quotation marks and must be constant) for the file to be included.  The compiler embeds the specified file into the source file at the point where it encounters this metacommand.  The included file may contain a subroutine, a single line, or any type of partial program, but must be written in Basmark QuickBASIC in ASCII format.  $include statements may be nested, but a depth limit exists.  That is, an included file may contain another $include metacommand. 

EXAMPLE

The first example includes the file named r01:
	30 rem $include: 'r10'
The second example uses the $include metacommand in a remark beginning with a single quote.  The included file is named proc.a:
	80 ' $include: 'proc.a'
A convenient way to share common areas between programs is to place common declarations and the necessary dim statements in a single file; putting the $include metacommand in both programs will make this file available to both programs.  For example, the BASIC source program prog1.b might contain
	10  rem $include: 'common.b'
		.
		.
		.
	100 chain "prog2"
where the source for "prog2" is
	10  rem $include: 'common.b'
		.
		.
		.
	100 chain "prog1"
and "common.b" contains
	11 dim a$(100)
	12 common i,j,k,a$()

SEE ALSO

common, rem

USAGE NOTES

Variables in the included files should match their counterparts in the main program, and included lines should not contain gotos to nonexistent lines.  Included files can be very useful for common declarations existing in more than one program, or for a library of user defined functions. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber