Include statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Incorporates the contents of a separate text file as part of a MapBasic program. Issuing this statement from the MapBasic window in MapInfo Pro does not work.

Syntax

Include "filename" 

filename is the name of an existing text file.

Restrictions

You cannot issue an Include statement through the MapBasic window.

Description

When MapBasic is compiling a program file and encounters an Include statement, the entire contents of the included file are inserted into the program file. The file specified by an Include statement should be a text file, containing only legitimate MapBasic statements.

If the filename parameter does not specify a directory path, and if the specified file does not exist in the current directory, the MapBasic compiler looks for the file in the program directory. This arrangement allows you to leave standard definitions files, such as MAPBASIC.DEF, in one directory, rather than copying the definitions files to the directories where you keep your program files.

The most common use of the Include statement is to include the file of standard MapBasic definitions, MAPBASIC.DEF. This file, which is provided with MapBasic, defines a number of important identifiers, such as TRUE and FALSE.

Whenever you change the contents of a file that you use through an Include statement, you should then recompile any MapBasic programs which Include that file.

Example

Include "MAPBASIC.DEF"