Guardian Programmer's Guide

Table Of Contents
Communicating With Terminals
Guardian Programmer’s Guide 421922-014
10 - 6
Transferring Data Between Application and Terminal
Opening the Home Terminal
To open the home terminal (the terminal that starts the application), you can find out
the name of the terminal using the PROCESS_GETINFO_ procedure. The
PROCESS_GETINFO_ procedure returns the terminal name and the name length.
You pass both of these parameters to the FILE_OPEN_ procedure.
ERROR := PROCESS_GETINFO_(!process^handle!,
!file^name:maxlen!,
!file^name^len!,
!priority!,
!moms^processhandle!,
TERMINAL^NAME:MAXLEN,
LENGTH);
IF ERROR <> 0 THEN ...
ERROR := FILE_OPEN_(TERMINAL^NAME:LENGTH,
TERMNUM);
IF ERROR <> 0 THEN ...
Transferring Data Between Application and Terminal
Use the WRITE[X], READ[X], and WRITEREAD[X] procedures to transfer information
between the application program and the terminal. The following paragraphs describe
how to do this.
Writing to a Terminal
Use the WRITE[X] procedure to write to a terminal as you would any file:
SBUFFER ':=' "Some text to display on the terminal "
-> @S^PTR;
CALL WRITEX(TERMNUM,
SBUFFER,
@S^PTR '-' @SBUFFER);
IF <> THEN ...
The above example writes the text placed into the string buffer to the terminal. The
W
RITEX procedure usually appends a carriage return/line feed sequence to the
specified bytes.
Reading From a Terminal
Use the READ[X] procedure to read from a terminal:
CALL READX(TERMNUM,
SBUFFER,
BUFSIZE,
COUNT^READ);
IF <> THEN ...