8 File Storage
READ LABEL {string variable [ON volume spec] string array name}
If a string variable is specified, the label on the volume will be returned in that variable. If the volume spec is not specified, READ LABEL returns the volume label of the current directory. If the string array name is given, the volume labels found will be returned in that array in the following form:
volume label :unit spec [*]
An * indicates the current volume.
The following is an example of the READ LABEL statement:
10 DIM A$(1:100) 20 READ LABEL A$(*) !Reads up to 100 volume labels. 30 FOR I=1 TO 100 40 IF LEN(A$(I))=0 THEN Done!Checks the length of the Ith element of A$. 50 P=POS(A$(I),":") !Looks for colon. 60 DISP A$(I)[1,P1];TAB(10);A$(I)[P;7];TAB(20);MAPVOL$(A$(I)[1,P-1]) 70 NEXT I 80 Done: ENDMAPVOL$ in line 60 is used to show which volume label and unit spec are matched to which directory.
Here are more examples:
READ LABEL A$ ON ""Returns the volume label of the current mass storage device.
READ LABEL A$ ON ":C2,7,2"Returns the volume label associated with the unit spec :C2,7,2.
READ LABEL A$ ON ",TEST"Simply returns the volume label TEST.
NOTE: "unit spec" are not supported on Windows NT and is not recommended on HP-UX.