Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.


11.2 Built-In Variables

The following variables are built in to E and are called system variables. They are global so can be accessed from any procedure.

arg
This is a string which contains the command line arguments passed your program when it was run (from the Shell or CLI). For instance, if your program were called fred and you ran it like this:

fred file.txt "a big file" another
then arg would the string:

file.txt "a big file" another
If you have AmigaDOS 2.0 (or greater) you can use the system routine ReadArgs to parse the command line in a much more versatile way. There is a worked example on argument parsing in Part Three (see 21 Argument Parsing).

wbmessage
This contains NIL if your program was started from the Shell/CLI, otherwise it's a pointer to the Workbench message which contains information about the icons selected when you started the program from Workbench. So, if you started the program from Workbench wbmessage will not be NIL and it will contain the Workbench arguments, but if you started the program from the Shell/CLI wbmessage will be NIL and the argments will be in arg (or via ReadArgs). There is a worked example on argument parsing in Part Three (see 21 Argument Parsing).

stdin, stdout, conout
The stdin and stdout variables contain the standard input and output filehandles. If your program was started from the Shell/CLI they will be filehandles on the Shell/CLI window (and conout will be NIL). However, if your program was started from Workbench these will both be NIL, and in this case the first call to WriteF will open an output `CON:' window and store the file handle for the window in stdout and conout. The file handle stored in conout will be closed using Close when the program terminates, so you can set up your own `CON:' window or file for use by the output functions and have it automatically closed. See 11.3.1 Input and output functions.

stdrast
The raster port used by E built-in graphics functions such as Box and Plot. This can be changed so that these functions draw on different screens etc. See 11.3.3 Graphics functions.

dosbase, execbase, gfxbase, intuitionbase
These are pointers to the appropriate library base, and are initialised by the E startup code, i.e., the Dos, Exec, Graphics and Intuition libraries are all opened by E so you don't need to do it yourself. These libraries are also automatically closed by E, so you shouldn't close them yourself. However, you must explicitly open and close all other Amiga system libraries that you want to use. The other library base variables are defined in the accompanying module (see 12 Modules).


Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.