
Requesting Waited Writes
Accessing Files
107365 Tandem Computers Incorporated
4–7
Use the routine in Figure 4-3,
waited_write
, to perform waited writes to the file
specified as the first argument in the invocation. If the file already contains data, this
routine appends the new data to the end of the file. To invoke this routine , load the
file and type:
waited_write
filename
The #INPUT call in Figure 4-3 reads a line from the TACL IN file.
Figure 4-3. Reading From a Terminal and Performing a Waited Write
?SECTION waited_write ROUTINE
#FRAME
#PUSH open_error write_error write_data write_prompt line
#PUSH write_file rslt
#SET #INPUTEOF 0
#SET rslt [#ARGUMENT /VALUE write_file/ FILENAME OTHERWISE]
[#CASE [rslt]
|1|
== Open the file:
#SET open_error [#REQUESTER/WAIT/WRITE [write_file]
write_error write_data]
[#IF [open_error] |THEN|
#OUTPUT *** Error opening [write_file]: [open_error]
#RETURN
]
[#LOOP |DO|
#APPEND write_data [#INPUT a_:]
== Add error checking here for output file if necessary
|UNTIL| [#INPUTEOF]
]
|OTHERWISE|
#OUTPUT *** Error: Invalid file ***
#RETURN
] == end #CASE
SINK [#REQUESTER/WAIT/CLOSE write_data]
#UNFRAME