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

Micro-ROM File System.
[File System API.]

Simple program space file system. More...

Functions

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

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

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

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

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


Variables

NUTDEVICE devUrom
 UROM device information structure.


Detailed Description

Simple program space file system.


Function Documentation

int NutRomFileClose ROMFILE   romf
 

Close a previously opened file.

Deprecated:
Use _close() or fclose() in new programs.
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.

Deprecated:
Use _open() or fopen() in new programs.
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,
size_t    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.

Deprecated:
New programs should use stdio.
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.
Returns:
The number of bytes read from the file or -1 if an error occured.

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.

Deprecated:
New programs should use stdio.

Bug:
stdio's seek is not working.
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.

Deprecated:
New programs should use stdio.

Bug:
stdio doesn't support fstat yet.
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.


Variable Documentation

NUTDEVICE devUrom
 

UROM device information structure.

All this UROM stuff is so simple, that it even mimics its own device driver.


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