11.07.2015 Views

BCL Programmers Manual V2.00 (PDF) - Barix

BCL Programmers Manual V2.00 (PDF) - Barix

BCL Programmers Manual V2.00 (PDF) - Barix

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

OPEN "C_R:usb://" AS H – open a file in read modeOPEN "C_W:usb://" AS H – open a file in write modeOPEN "C_A:usb://" AS H – open a file in append modeWhere filename is the full path name of the file to be accessed (starting with slash).Example:OPEN "C_R:usb:///music/Rolling_Stones/song01.mp3" AS 1If a file is open for writing and it does not exist, it is automatically created. Already existingfiles are truncated to zero (C_W write mode) or newly written data are appended to the end ofthe file (C_A append mode).Once the file is open it can be read and written using READ and WRITE calls. Besides themthe following calls are available.FILEPOS( H )Returns the current file position for the file handle H (offset in bytes from beginning of the file).SEEK H, ESets the current file position of the file H to the position E (in bytes from the beginning of thefile).FILESIZE ( H )Returns the size of the file H in bytes.RENAME OLD$, NEW$Renames the file OLD$ to NEW$. OLD$ is a full path including the device identifier andpossibly directory names. NEW$ is just a filename and must not contain any device identifieror slashes. Therefore it cannot move the file into another directory. The OLD$ and NEW$names must be short ones in the 8.3 format.Example:RENAME "usb:///dir/readme.txt", "readme"Renames the file readme.txt in directory dir to readme.DELETE S$Deletes a file (not directory!) with the name S$ on the USB filesystem.Example:DELETE "usb:///dir/filename.ext"Deletes the file filename.ext in directory dir.WARNING: The file has to be closed before deleting.See also a program example 14.1 on page 79 how to play a file.7.6.2 Directory accessUse the following command to read a directory:OPEN "C_R:usb://" AS H – open a directory in read modeWhere filename is the full path name of the file to be accessed (starting with a slash).In the directory mode each READ call returns a descriptor of the next directory entry in S$.The descriptor starts with the filename in 8.3 format followed by 16-bit flag. The appropriateshort name is returned for files with long names. The first two entries returned are “.” for thecurrent directory and “..” for the parent directory.<strong>Barix</strong> AG | 37/106

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!