Hardware manual
Impact Reference Guide Commands and Functions R-V
5-23 Datalogic Automation Inc.
You can also open an existing file and write (append) additional records to the end of it. This example opens
the existing file named yourfile.txt in the current directory and adds the string "Another line" to it. IMPOR-
TANT: File names are case sensitive.
open "yourfile.txt" for append as 1
print#1,"Another line\n"
close 1
Open - Input
This example opens the myfile.txt file for reading, then assigns the input string to the string variable
in_string. If you used the newline character to create your file, you will need a "line input" assignment state-
ment for each line in the file.
open "myfile.txt" for input as 1
line input #1, in_string
close 1
PI
This function returns the value of the constant pi (the ratio of a circle’s circumference to its diameter).
Example:
circum_value = pi yields circum_value = 3.141593
POW
This function returns the value of 10 to the power of the argument. Example:
pow_value = POW(2) yields pow_value = 100
PRINT
(CPM Only) This function writes to an open file. The file number must refer to a currently open file. This
example opens the file "myfile.txt," writes the string "This is the first line" into it, then closes the file.
open "myfile.txt" for output as 1
print#1,"This is the first line\n"
close 1
Commands and Functions R-V
REM
You should put comments in your Basic code to make it more understandable. To indicate a comment, put
this command at the beginning of a line, followed by one or more spaces. (Also see “Comments” on page 5-
2.) You cannot put a comment at the end of a statement. Example:
‘This is a comment line.
REM This is a comment also. Here is the energy calculation
e = m*(c*c)
Repeat Until
This construct repeats the loop body until the expression is True. The expression is evaluated after the exe-
cution of the loop body so the loop body is always executed at least once.
Repeat