GEMDOS Device I/O and Process Control
Table 5-1. Four Modes
for Pexec() Function (continued)
Mode
Number
Function File
Command Env
3 Just load,
Pointer to
Pointer to Pointer to
do not filename
command string environment
execute
string string
4 Just Unused Basepage
unused
execute address
5 Create
Unused Pointer to Pointer to
basepage
command string environment
string.
The mode used most often is 0, load and go. In this
mode, file is a pointer to a string containing the complete
path name of the program file to load and execute. This
string is a series of ASCII characters, ending with ASCII
character 0 (NUL). Example path names are PRO-
GRAM.PRG, C:\PROGRAMS\PRGl.TOS and B:\MYPROG.
Path names are discussed more fully in Chapter 6, which
deals with the GEMDOS file system. The command parameter
contains a pointer to a command tail string. This type of
string is used with a .TTP (TOS Takes Parameters) type pro
gram to specify more fully what the program should do. For
example, a program called COPY.TTP that copies one file to
another might be executed with the command tail ArFILEl B:
FILE2, which tells the program to copy a file named FILE1
on the A: drive to a file called FILE2 on the B: drive.
The command tail string is not the usual C language
string, that consists of a series of ASCII characters ending
in NUL. Instead, it is more like strings used in Pascal, where
the first character of the string is a binary number specifying
the length of the string and the rest of the string is com
posed of the actual ASCII characters. Such a string does not
normally end in an ASCII 0 character. The final parameter
for a mode 0 Pexec() call, env, is a pointer to the process'
environment string. This is a series of null-terminated ASCII
strings with an additional ASCII 0 character at the end of all
of the strings. The environment string is used by some pro
grams to get information about the program environment. A
typical environment string might be PATH = C:\, which lets
the program know the default directory to use to search for
data files. If a 0 is passed in the
env parameter, the new pro
101