13 245
Application Sample Programs
File Transfer Function
1. Chapter Title
2. Chapter Title 13. Application Sample
4. Chapter Title
5. Chapter Title
Programs
70 Dir_instr(@Agt4294)
80 !
90 END
100 !
110 ! Dir_instr
120 !
130 SUB Dir_instr(@Agt4294)
140 DIM Stor_dev$[6],Curr_dir$[50],File_name$[13]
150 !
160 OUTPUT @Agt4294;"STOD?"
170 ENTER @Agt4294;Stor_dev$
180 OUTPUT @Agt4294;"CWD?"
190 ENTER @Agt4294;Curr_dir$
200 PRINT "["&Stor_dev$&"]: "&Curr_dir$
210 PRINT "Size[byte] File Name"
220 PRINT "------------------------"
230 OUTPUT @Agt4294;"FNUM?"
240 ENTER @Agt4294;File_count
250 IF File_count>=1 THEN
260 FOR I=1 TO File_count
270 OUTPUT @Agt4294;"FNAME? ";I
280 ENTER @Agt4294;File_name$
290 OUTPUT @Agt4294;"FSIZE? """&File_name$&""""
300 ENTER @Agt4294;File_size
310 PRINT USING "XX,DDDDDD,XXXX,K";File_size,File_name$
320 NEXT I
330 END IF
340 SUBEND
Line 70 Calls the subprogram to display the list of the files in the current
directory.
Lines 160 to 200 Check the storage device currently selected and its current directory
name, and then display the result.
Lines 230 to 240 Check the number of the files in the current directory.
Lines 250 to 330 If there are any files in the current directory, check the name and size
of every file and display them.
The following is the output result of the program, assuming that the selected storage device
is the Ram disk and the current directory, \TEST, contains 2 files, FILE1.STA (size: 24576
bytes) and FILE2.TIF (size: 16384 bytes) and 1 directory, DIR1. For size of a directory, -1
is displayed. To view the list of the files in DIR1, use the CHAD' command to change the
current directory to DIR1 and then execute this program again.
[MEMO]: \TEST
Size[byte] File Name
------------------------
-1 ..\
-1 DIR1\
24576 FILE1.STA
16384 FILE2.TIF