Demonstration C Programs
by Dec McSweeney

Note: These programs require System resources. You must ensure that !System has been 'seen' before running this program.

Contained within the !C application directory are two compiled C programs, called Calc and Date. Both are run from the command line and take command line arguments.

Calc is a simple calculator, capable of adding, subtracting, multiplying or dividing two integers. It takes three parameters: the first operand, then the operator (+, -, * or /), then the second operand. It then prints out the result. For instance '*Calc 5 * 6' results in '30' being printed. Each parameter must be separated from the others by a space.

Date prints out the current date and/or time from a format string, of the type assigned to Sys$DateFormat. Date takes one parameter, which must be enclosed in quotes if spaces are to be included. It then prints the current monotonic time as five hex bytes, followed by the date, printed according to the given format string. For more information on format strings, refer to the section 'Using system variables' in the User Guide.

When run, the programs Calc and Date are demonstrated by running the command file Demo. This first runs Calc four times to demonstrate addition, subtraction, multiplication and division. It then runs Date twice to demonstrate two different date formats.

The source code files for these programs are saved in !C.c, and can be examined by loading them into Edit.
