beautypg.com

Philips Bluetooth QuickStart Kit User Manual

Page 52

background image

Bluetooth QuickStart Kit Version 1.0 - User’s Guide

Page 52

Copyright 2004-2005 © Embedded Artists AB

B.4 File System API

B.4.1 fatOpen

tFatResult fatOpen( const tU8* pPath, const tU8* pMode,
tFatHandle* pHandle )

This function attempts to open the file with the specified absolute path. If successful, the
pHandle will hold the handle to the opened file. Note that pHandle must only be used if
FAT_OK is returned.

Parameters:

[in] pPath - The absolute path of the file to open.

[in] pMode - Specifies how the file will be used:

"r" = Read only

"w" = Write only, existing file will be cleared

"a" = Write only, new data will be appended to existing

"r+" = Read and Write, new data will be appended to existing

"w+" = Same as "r+"

"a+" = Same as "r+"

[out] pHandle - A handle to the file.

Returns:

FAT_OK if the file was opened, otherwise one of the error codes

Possible error situations (what can be identified in an error code):

FAT_OK

- The function completed successfully.

FAT_ERROR_A_FOLDER

- If pPath points to a folder and not a file

FAT_ERROR_TOO_MANY_OPEN

- No more free handles

FAT_ERROR_INV_MODE

- Not a valid pMode

FAT_ERROR_READ_ONLY

- If mode is 'w' or 'a' and writing is not allowed by

m_fat_media_allow_write()

FAT_ERROR_FS_NOT_INITIALIZED

- The fatInit() function has not been called

B.4.2 fatFileSize

tFatResult fatFileSize( const tFatHandle handle, tU32* pSize )

Returns the size of the specified file.

Parameters:

[in] handle – A handle to the file.

[out] pSize – The size of the file.

Returns:

FAT_OK if the file size could be determined, otherwise an error code

Possible error situations (what can be identified in an error code):

FAT_OK

- The function completed successfully.

FAT_ERROR_A_FOLDER

- The handle points to a folder, not a file

FAT_ERROR_INV_HAND

- The handle is invalid