Specifications
Chapter 8 181
Save and Recall Files
Example Programs for Saving/Recalling a File
8. Save and Recall Files
Example 8-1 Saving/Recalling (HTBasic)
10 DIM File$[256],Inp_chr$[30],Err_mes$[50],Extension$[3]
20 INTEGER Err_no
30 !
40 CLEAR SCREEN
50 ASSIGN @Agte4991a TO 717
60 !
70 Menu: BEEP
80 PRINT " Save/Recall Menu"
90 PRINT "-------------------------------------"
100 PRINT " 1: return and changes current holder"
110 PRINT " 2: saves state file"
120 PRINT " 3: recall state file"
130 PRINT " 4: saves data file"
140 PRINT " 5: recall data file"
150 PRINT " 6: saves CITIfile"
160 PRINT " 7: saves graphics data"
170 PRINT " 8: quit"
180 PRINT
190 INPUT "Input 1 to 8",Inp_chr$
200 !
210 SELECT Inp_chr$[1,2]
220 CASE "1"
230 CALL Chn_curr_holder(@Agte4991a)
240 CASE "2"
250 CALL Save_state(@Agte4991a)
260 CASE "3"
270 CALL Recall_state(@Agte4991a)
280 CASE "4"
290 CALL Save_data(@Agte4991a)
300 CASE "5"
310 CALL Recall_data(@Agte4991a)
320 CASE "6"
330 CALL Save_citi(@Agte4991a)
340 CASE "7"
350 CALL Save_graphics(@Agte4991a)
360 CASE "8"
370 GOTO Quit
380 END SELECT
390 GOTO Menu
400 !
410 Quit:!
420 END
430 !
440 !
450 SUB Chn_curr_holder(@Agte4991a)
460 DIM Holder$[256],Inp_chr$[30],Err_mes$[50]
470 INTEGER Err_no
480 !
490 OUTPUT @Agte4991a;"MMEM:CDIR?"
500 ENTER @Agte4991a;Holder$
510 PRINT "current holder name: "&Holder$
520 PRINT
530 Input_name:!
540 INPUT "Do you want to change current holder?
[Y/N]",Inp_chr$