443
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
An imaginary "directory pointer" walks through the file record table (FRT) of the
flash disk. The fd.resetdirpointer method resets the directory pointer to 0, i.e. to
the very first directory record. The fd.getnextdirmember returns the next file name
and advances the pointer. Only file names are returned,
are excluded.
Calling the fd.getnextdirmember repeatedly will get you all the file names. When
there are no more names left to go through, the method will return an empty
string. You can use this to end your directory walk:
'walk through the file directory -- method #1
Dim
s
As
String
fd.resetdirpointer
Do
s=fd.getnextdirmember
If
fd.laststatus<>PL_FD_STATUS_OK
Then
'some problem
End
If
...
'process the file name in s
Loop
While
s<>""
'we exit on empty string
Alternatively, you can use a for-next cycle, since the number of currently stored
files can be checked through the
method:
'walk through the file directory -- method #2
Dim
s
As
String
Dim
f
As
Byte
fd.resetdirpointer
For
f=1
To
fd.getnumfiles
s=fd.getnextdirmember
If
fd.laststatus<>PL_FD_STATUS_OK
Then
'some problem
End
If
...
'process the file name in s
Next
f
Opening Files
You must first open a file in order to work with its data. The
method
opens a file with a specified name and "on" a file number currently selected by the
property. All operations related to the file data are then performed by
referring to the file number, not the file name. These operations include
,
,
, and
.
The concept of file numbers is not new -- other operating systems, too, assign a
number to the file when the file is opened. In Tibbo Basic, you select the number
you want to open the file on yourself. You do this by selecting a desired value for
the fd.filenum property:
442
471
475
463
444
445
446
448