![Agilent Technologies Agilent 4396B Gpib Programming Manual Download Page 87](http://html.mh-extra.com/html/agilent-technologies/agilent-4396b/agilent-4396b_gpib-programming-manual_2867995087.webp)
Displaying
List
of
Files
in
Current
Directory
This
program
displays
the
list
of
the
les
in
the
current
directory
.
d
a
c
b
10
!
20
!
Figure
11-9.
File
list
30
!
40
ASSIGN
@Hp4396
TO
717
50
OUTPUT
@Hp4396;"*rst"
60
!
70
Dir_instr(@Hp4396)
80
!
90
END
100
!
110
!
Dir_instr
120
!
130
SUB
Dir_instr(@Hp4396)
140
DIM
Stor_dev$[5],Curr_dir$[50],File_name$[13]
150
!
160
OUTPUT
@Hp4396;"STODMEMO?"
170
ENTER
@Hp4396;A
180
IF
A=1
THEN
190
Stor_dev$="MEMO"
200
ELSE
210
Stor_dev$="DISK"
220
END
IF
230
OUTPUT
@Hp4396;"CWD?"
240
ENTER
@Hp4396;Curr_dir$
250
"["&Stor_dev$&"]:
"&Curr_dir$
260
"Size[byte]
File
Name"
270
"------------------------"
280
OUTPUT
@Hp4396;"FNUM?"
290
ENTER
@Hp4396;File_count
300
IF
File_count>=1
THEN
310
FOR
I=1
TO
File_count
320
OUTPUT
@Hp4396;"FNAME?
";I
330
ENTER
@Hp4396;File_name$
340
OUTPUT
@Hp4396;"FSIZE?
"""&File_name$&""""
350
ENTER
@Hp4396;File_size
360
USING
"XX,DDDDDD,XXXX,K";File_size,File_name$
370
NEXT
I
380
END
IF
390
SUBEND
Figure
11-10.
Sample
Program:
Displaying
List
of
Files
in
Current
Directory
of
4396B
Line
70
calls
the
subprogram
to
display
the
list
of
the
les
in
the
current
directory
.
Lines
160
to
250
check
the
storage
device
currently
selected
and
its
current
directory
name
,
and
then
display
the
result.
Lines
280
to
290
check
the
number
of
the
les
in
the
current
directory
.
If
there
are
any
les
in
the
current
directory
,
lines
300
to
380
check
the
name
and
size
of
every
le
and
display
them.
Using
Application
Programs
11-15