441
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
Checking Disk Vitals
, you can check several important flash disk
parameters:
will tell you the number of usable data sectors on the disk
(reminder: each sector stores 256 bytes of data).
will tell you how many sectors are used for internal
"housekeeping" of the flash disk.
will indicate how many sectors the disk occupies in flash memory.
Fd.totalsize=fd.cfd.numservicesectors.
method will return the number of free data sectors on the
disk.
Creating, Deleting, and Renaming Files
You can't really do anything useful with the flash disk unless you create at least
one file. The
method is used for this. The string you supply as an
argument must include a file name and may also contain the
. Some
examples:
If
fd.create("File1.dat R 25-JUL-2008")<>PL_FD_STATUS_OK
Then
'
<File1.dat> is the file name, <R 25-JUL-2008> -- attributes.
'some problem
End
If
If
fd.create(" File2")<>PL_FD_STATUS_OK
Then
'no attributes defined for
this file. Notice leading spaces -- they will be removed.
'some problem
End
If
If
fd.create("Database/users.dat")<>PL_FD_STATUS_OK
Then
'and here we
emulate a directory
'some problem
End
If
If
fd.create("file 3")<>PL_FD_STATUS_OK
Then
'if the idea was to create a
<file 3> file, then this won't work! "3" will be interpreted as
attributes!
'some problem
End
If
Naturally, each file on the flash disk must have a unique name, or the 5-
PL_FD_STATUS_DUPLICATE_NAME error will be generated. Every existing file
always has at least one data sector allocated to it. This is how the 7-
PL_FD_STATUS_DATA_FULL error may be generated when you are creating a new
file. Finally, the total number of files stored on the flash disk is limited to what you
defined when
your disk. This maximum can be checked through the
R/O property. Try to exceed this number and you will get the
6- PL_FD_STATUS_FILE_TABLE_FULL error code.
To delete a file, use the
method:
439
458
475
483
470
462
440
436
474
463