Library functions: system functions |
This category includes functions to interact with the environment outside the Proteus program.
The functions are:
GETENV(cLabel)
returns the string associated to cLabel in the environment, an empty string if cLabel is undefined
PUTENV(cLabel, cVal)
updates with cVal the string associated to cLabel in the environment; returns 0 if the environment space is full, 1 otherwise.
Note: this function, if called several times, causes a loss of memory because of the low-level implementation of the C library function putenv; this is true for the Unix version - the problem does not exist in the Windows/Ms-Dos versions
ARGV(n)
returns the parameter n passed on the command line:
- 1 = Proteus interpreter
- 2 = script
- 3 = input file
- 4 = output file (even if it was not specified)
- 5-ARGC = other parameters
DATE()
returns current system date, formatted according to DATE_TYPE
TIME()
returns current system time, formatted according to TIME_TYPE
ISTIME(c)
returns 1 if c is in the format "hh:mm:ssx", where mm and ss are in the range 0-59, hh is in the range 1-12 (if x is 'p' or 'a') or 0-23 (if x is a space); returns 0 otherwise
TIMETOSEC(c)
returns the number of seconds in the time c; see ISTIME for the time format; returns -1 if the time is invalid
TIMEFROMSEC(nSeconds)
returns the time corresponding to nSeconds, formatted according to TIME_TYPE; nSeconds can also exceed the number of seconds in a day; this function returns an empty string if nSeconds is negative
CLOCK()
number of seconds elapsed from the start of the Proteus interpreter
SLEEP(nfSeconds)
suspends the execution of the script for nfSeconds; returns the number of seconds elapsed (at the end of the call) from the start of the Proteus interpreter. This function accepts floating point values; e.g. SLEEP(0.5) suspends execution for half a second
SYSTEM(cCommand)
runs cCommand and returns the error level at the exit; use:
SYSTEM("COMMAND /C string")or
SYSTEM("cmd /C string")to run internal Ms-Dos/Windows commands; note: file names included in cCommand are not influenced by the command line parameter -k
CAPTURE(cCommand, cStdout[, cStderr[, cStdin]])
runs cCommand and returns the error level at the exit, like SYSTEM; the difference is the possibility to specify two variables where the standard output and the standard error will be redirected, and a string of character to be used for input; cStdout and cStderr are modified by reference (must be two variables); cStdin can be a constant or a variable
EXEC(cCommand)
runs cCommand and exits from Proteus; use:
EXEC("COMMAND /C string")or
EXEC("cmd /C string")to run internal Ms-Dos/Windows commands; note: file names included in cCommand are not influenced by the command line parameter -k
Start of page | Next topic | Previous topic | Contents | Index |