SYSTEM LIBRARY
A Programming Language Manual




sys_time
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_time( )

OUT
int tickcount time (ms)

Returns the computer's time counter, called Tick Count, in milliseconds (1sec = 1000 ms).
This counter is incremented each millisecond, since the computer was started.
This function can be used to track time.


 C/C++ source code


sys_localtime
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int, int, int sys_localtime( )

OUT
int hour [0-23]
int minute
int sec

Returns the local computer's time.

 C/C++ source code


sys_localdate
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int, int, int sys_localdate( )

OUT
int year (4 digits)
int month
int day

Returns the local computer's date.

 C/C++ source code


sys_scanln
( lib: System, file: ../src/gs/gslib_system_win.cpp )
str sys_scanln( )

OUT
str input line

Waits for the user to input some text in the console and to hit enter, then returns it as a string.
This instruction is usefull only in text console applications.
There's an decent limit of input text (256 characters).




 C/C++ source code


sys_getchar
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_getchar( )

OUT
int ASCII code

Waits for the user to type a character and hit enter to return the character's ASCII code.



 C/C++ source code


sys_getkey
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_getkey( )

OUT
int key code

Waits for the user to hit a key and returns the key's code.
For printable characters the key code is the associated ASCII code.
For special keys like arrows or function keys, the codes are higher values.




 C/C++ source code


sys_shell
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_shell( filename, workdir, cmdline )

IN
str filename path to a file
str workdir start directory (optional)
str cmdline command line parameters (optional)
OUT
int 1=success, 0=fail

Execute the file filename or opens it in the default viewer associated with the file's extension.
The default web browser is used for .html, text viewer for .txt, etc.
Starting folder workdir and command line cmdline parameters are optional.


 C/C++ source code


sys_launch
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_launch( exefile, workdir, cmdline )

IN
str exefile path to an executable file
str workdir start directory (optional)
str cmdline command line parameters (optional)
OUT
int 1=success, 0=fail

Launch an executable (.exe) file.
Starting folder workdir and command line cmdline parameters are optional.


 C/C++ source code


sys_command
( lib: System, file: ../src/gs/gslib_system_win.cpp )
sys_command( cmdline )

IN
str cmdline command line to execute

Executes a command line like a batch (.bat) command.
Returns the result of the call (-1 means error).


 C/C++ source code


sys_commandline
( lib: System, file: ../src/gs/gslib_system_win.cpp )
str sys_commandline( )

OUT
str command line

Returns the command line the console or the embedding application was launched with.
The command line will begin with the executable file's name that may use quotes.
The GS9 console command line will continue with the name of the program file, since that is the first parameter.


 C/C++ source code


sys_fileexist
( lib: System, file: ../src/gs/gslib_system_win.cpp )
str sys_fileexist( filename )

IN
str filename path to a file
OUT
str 1=yes, 0=no

Tell if a file exists (and can be opened).

 C/C++ source code


sys_fileinfo
( lib: System, file: ../src/gs/gslib_system_win.cpp )
str sys_fileinfo( filename )

IN
str filename path to a file
OUT
str file info string in a fixed format

Returns file info in the following format: "Wed Jan 02 02:03:55 1980\nFILE_SIZE".
The FILE_SIZE substring have variable length, but the first part is fixed.
If file is not found, an empty string is returned.


 C/C++ source code


sys_filedelete
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_filedelete( filename )

IN
str filename path to file
OUT
int 1=success, 0=fail

Deletes the specified file from hard disk.

 C/C++ source code


sys_filefind
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_filefind( path, recursive, callback )

IN
str path path to a directory or "" for current
int recursive go deep into directories
fnc callback function to be called for each file or directory found (optional)
OUT
int number of files found (no directories)

Finds all files from the given directory name. The directory name must include the ending back slash.
For each file or directory found the callback function is called.
If recursive is 1, the files will be searched deep into any found directories.
The callback function must have two parameters: filepath (str), and isdir (int) that are received from the find cycle.
If the callback is missing the find is used to count the files.




 C/C++ source code


sys_directoryget
( lib: System, file: ../src/gs/gslib_system_win.cpp )
str sys_directoryget( )

OUT
str path to the current directory

Returns a string containing the path of the current directory.

 C/C++ source code


sys_directoryset
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_directoryset( pathdir )

IN
str pathdir path to the directory to set as current
OUT
int 1=success, 0=fail

Changes current directory to pathdir.

 C/C++ source code


directorycreate
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int directorycreate( pathdir )

IN
str pathdir path to a directory
OUT
int 1=success, 0=fail

Creates a new folder.
The path up to the directory must exists.


 C/C++ source code


sys_directorydelete
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_directorydelete( pathdir )

IN
str pathdir path to a directory
OUT
int 1=success, 0=fail

Delete anexisting folder.
The path up to the directory must exists.


 C/C++ source code


sys_messagebox
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_messagebox( text, title, type=MB_OK )

IN
str text some text message
str title box title (optional)
int type=MB_OK buttons and icon flags (optional)
OUT
int selected button id

Pops an Windows message box with the specified parameters.
The type can be a binary combination of button and icon options.
MB_OK, MB_OKCANCEL, MB_YESNO, MB_YESNOCANCEL, MB_RETRYCANCEL, MB_ABORTRETRYIGNORE for specifying the box's buttons.
MB_ICONEXCLAMATION, MB_ICONQUESTION, MB_ICONERROR for specifying the box's icon
MB_SYSTEMMODAL for blocking other applications until this box is closed
It returns a response generating by chooseing one of the box's buttons.
IDOK, IDCANCEL, IDYES, IDNO, IDABORT, IDRETRY, IDIGNORE




 C/C++ source code


sys_messagebeep
( lib: System, file: ../src/gs/gslib_system_win.cpp )
int sys_messagebeep( type=-1 )

IN
int type=-1 sound (optional)
OUT
int 1=success, 0=fail

Generate an Windows message beep with the specidied parameters.
The type can be one of the following:
MB_ICONEXCLAMATION, MB_ICONQUESTION, MB_ICONERROR for specifying the box's icon.




 C/C++ source code


MB_OK
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_OK

Used by sys_messagebox to specify dialog buttons.


MB_OKCANCEL
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_OKCANCEL

Used by sys_messagebox to specify dialog buttons.


MB_RETRYCANCEL
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_RETRYCANCEL

Used by sys_messagebox to specify dialog buttons.


MB_YESNO
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_YESNO

Used by sys_messagebox to specify dialog buttons.


MB_YESNOCANCEL
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_YESNOCANCEL

Used by sys_messagebox to specify dialog buttons.


MB_ABORTRETRYIGNORE
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_ABORTRETRYIGNORE

Used by sys_messagebox to specify dialog buttons.


MB_ICONEXCLAMATION
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_ICONEXCLAMATION

Used by sys_messagebox or sys_messagebeep to specify icon or sound.


MB_ICONQUESTION
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_ICONQUESTION

Used by sys_messagebox or sys_messagebeep to specify icon or sound.


MB_ICONERROR
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_ICONERROR

Used by sys_messagebox or sys_messagebeep to specify icon or sound.


MB_SYSTEMMODAL
( lib: System, file: ../src/gs/gslib_system_win.cpp )
MB_SYSTEMMODAL

Used by sys_messagebox for blocking message boxes.


IDOK
( lib: System, file: ../src/gs/gslib_system_win.cpp )
IDOK

Returned by sys_messagebox depending on the dialog response.


IDCANCEL
( lib: System, file: ../src/gs/gslib_system_win.cpp )
IDCANCEL

Returned by sys_messagebox depending on the dialog response.


IDYES
( lib: System, file: ../src/gs/gslib_system_win.cpp )
IDYES

Returned by sys_messagebox depending on the dialog response.


IDNO
( lib: System, file: ../src/gs/gslib_system_win.cpp )
IDNO

Returned by sys_messagebox depending on the dialog response.


IDABORT
( lib: System, file: ../src/gs/gslib_system_win.cpp )
IDABORT

Returned by sys_messagebox depending on the dialog response.


IDRETRY
( lib: System, file: ../src/gs/gslib_system_win.cpp )
IDRETRY

Returned by sys_messagebox depending on the dialog response.


IDIGNORE
( lib: System, file: ../src/gs/gslib_system_win.cpp )
IDIGNORE

Returned by sys_messagebox depending on the dialog response.