Top  Previous  Next


Includes an ASCII file in the program at the current position.




$INCLUDE "file"





Name of the ASCII file, which must contain valid BASCOM statements.


This option can be used if you make use of the same routines in many programs. You can write modules and include them into your program.

If there are changes to make you only have to change the module file, not all your BASCOM programs.

You can only include ASCII files!


An include file will only be included once, even if you include it multiple times.


Use $INC when you want to include binary files.



You can specify an absolute file name (with a drive and full path) like : $INCLUDE "c:\folder\myfile.bas"

Or you can specify a relative file name like : $INCLUDE "myfile.bas"

The main program path will be used to determine the absolute file name.

If your main file is stored under c:\abc\main.bas , and you include a file named "test.inc" , the compiler expects a file named "c:\abc\test.inc"


You can include a path too. The path is relative to the main file.

When used in sub folders use " \ " (back slash). The path uses the DOS/Windows convention. A forward slash will work too since windows does not seem to be bothered with it.

Example with sub folder Test: $include "Test\my_functions.bas"





See Also





$regfile = "m48def.dat"

$crystal = 4000000

$hwstack = 10
$swstack = 10
$framesize = 26

$baud = 19200

Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0




'Note that the file 123.bas contains an error

$include "123.bas"                       'include file that prints Hello

Print "Back in INCLUDE.BAS"