Chapter 7 285
Integrating Programs In Other Languages
Using a System Command
Using a System Command
To call a compiled program in another language, you can type in the
executable file and any parameters in the
Execute Program object.
However, to execute an MS DOS system command, you must first run the
DOS command interpreter. In this exercise, you will run the DOS command
interpreter and execute an MS DOS system command.
Lab 7-1: Using a System Command (PC)
1. Select I/O ⇒ Execute Program (PC). Click the Prog with
params
field to get a cursor, then type:
command.com /c dir >> c:\bob
Note Replace command.com with cmd for Windows NT 4.0 or Windows 2000. If
the drive letter is different from
c:, then substitute that drive letter in these
instructions. On NT, you may have to specify a directory for which you have
write permissions.
(You may need to include the complete path of the
command.com
executable.) The command runs the DOS command interpreter, which
runs the system command to display the current directory, and redirects
the output (
>) to the bob file instead of the computer screen.
Leave
Yes for the Wait for prog exit selection. Leave Normal for
Run Style, and enter c:\ for the Working directory.
2. Select
I/O ⇒ From ⇒ File and place it below Execute Program.
Connect the sequence out pin of
Execute Program to the sequence in
pin of the
From File object.
Click the
From File: input field labeled myFile to get a list box, enter
c:\bob, then click OK. (The program creates the file bob for you.)