Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

Micro-ROM File System.

Simple program space file system. More...

Functions

ROMFILENutRomFileOpen (char *name)
 Opens an existing file for reading. More...

int NutRomFileClose (ROMFILE *romf)
 Close a previously opened file. More...

int NutRomFileRead (ROMFILE *romf, void *data, int size)
 Read data from a file. More...

int NutRomFileSize (ROMFILE *romf)
 Retrieve the size of a file. More...

int NutRomFileSeek (ROMFILE *romf, int pos)
 Move the file pointer to a new position. More...


Detailed Description

Simple program space file system.


Function Documentation

int NutRomFileClose ( ROMFILE * romf )
 

Close a previously opened file.

Parameters:
romf   Identifies the file to close. This pointer must have been created by calling NutRomFileOpen().

Returns:
0 if the function is successful, -1 otherwise.

ROMFILE * NutRomFileOpen ( char * name )
 

Opens an existing file for reading.

Parameters:
name   Points to a string that specifies the name of the file to open. The name must exactly match the full pathname of the file.

Returns:
A pointer to a ROMFILE structure that can be used to read from the file and retrieve information about the file.

int NutRomFileRead ( ROMFILE * romf,
void * data,
int size )
 

Read data from a file.

Read up to a specified number of bytes of data from a file into a buffer. The function may read fewer than the specified number of bytes if it reaches the end of the file.

Parameters:
romf   Identifies the file to read from. This pointer must have been created by calling NutRomFileOpen().
data   Points to the buffer that receives the data.
size   Specifies the number of bytes to read from the file.
The   number of bytes read from the file or -1 if an error occured.

Returns:
The number of bytes read or -1 in case of an error.

int NutRomFileSeek ( ROMFILE * romf,
int pos )
 

Move the file pointer to a new position.

The file pointer is maintained by Nut/OS. It points to the next byte to be read from a file. The file pointer is automatically incremented for each byte read. When the file is opened, it is at position 0, the beginning of the file.

Parameters:
romf   Identifies the file to seek. This pointer must have been created by calling NutRomFileOpen().
pos   Specifies the new absolute position of the file pointer.

Returns:
0 if the function is successful, -1 otherwise.

int NutRomFileSize ( ROMFILE * romf )
 

Retrieve the size of a file.

Parameters:
romf   Identifies the file to query. This pointer must have been created by calling NutRomFileOpen().

Returns:
The number of bytes in this file or -1 if an error occured.


© 2000-2001 by egnite Software GmbH - visit http://www.ethernut.de/