ID : 115
#Include
Function
Read a designated file.
Syntax
#Include "file path"
or
#Include <file path>
Guaranteed entry
- File path
-
Designate the file path to read.
Files that can be read are program files (.pcs) and header files (.h).
For program files (.pcs) and header files (.h) created by customers, bracket the file path with double quotes (""). To use system header files, bracket the file path with inequality signs (<>) .
Wildcard characters can be used for a file name. Wildcard is a special character which expresses [arbitrary character]. There are two types of wildcards, "*" (asterisk) and "?" (question mark).
"*" represents a string of arbitrary character.
"?" represents a single character.
(Example) In case of "abe.pcs,abce.pcs,abcde.pcs"
・ a*e.pcs stands for abe.pcs,abce.pcs,abcde.pcs
・ a?e.pcs stands for abe.pcs
・ a??e.pcs stands for abce.pcs
Description
When compiling, this command reads the contents of the specified file, and then pastes it to the file (a calling file) where “#Include” is written, and then the pasted contents are compiled as a part of the calling file (see "Calling a Procedure from a Program File”).
When it is compiled, the procedure name of “main” is replaced by the file name specified. If the same file is specified two times or more, files that are specified later than the second are not read in. If the calling file is specified, the file is not read in.
Assume that the “pro1.pcs” is as follows
#Include pro2.pcs #Include pro2.pcs #Include pro1.pcs
Line two and line three are ignored at compiling.
Related Terms
Attention
- Read-in file is decompressed in the line of #Include.
- Panel screen files cannot be read.
- Wild card cannot be used for folder names.
-
As mentioned above, there are two ways to bracket the file name; inequality sings and double quotes.
If double quotes are used, the preprocessor starts searching the specified file name from the user folder where #Include is written, and then if it is not found, the preprocessor moves to the system header file to search further.
The result between using double quotes and inequality signs can be different at times.
Assume that there are two different files which have the same name “ABC.h”; one is a system header file, and the other is a header file, which has been prepared by customer.
When you write #Include to read the system header file"ABC.h", you inadvertently use the double quotes to bracket the file name. As a result, the preprocessor will read the customer-prepared header file“ABC.h”.
Example
'!TITLE "Reading Preprocessor Program"
' Read a header file and a pcs file
' Read a TEST.h file
#Include "TEST.h"
' Read an Include_Sample2.pcs file
#Include "Include_Sample2.pcs"
Sub Sample_Include
Dim aaa As String
' Assign a symbolic constant NAME in the TEST.h file to aaa
aaa = NAME
' Display a string within the TEST.h file on the message output window
PrintDbg aaa
' Call Include_Sample2.pcs file
Call Include_Sample2
End Sub
ID : 115