#include <ma.h>
Defines | |
#define | SEEK_SET 0 |
#define | SEEK_CUR 1 |
#define | SEEK_END 2 |
#define | EOF (-1) |
#define | FILENAME_MAX 256 |
#define | fopen MA_fopen |
#define | fread MA_fread |
#define | fwrite MA_fwrite |
#define | fclose MA_fclose |
#define | fseek MA_fseek |
#define | feof MA_feof |
#define | ferror MA_ferror |
#define | rewind MA_rewind |
#define | fgetc MA_fgetc |
#define | fputc MA_fputc |
#define | fgets MA_fgets |
#define | fputs MA_fputs |
#define | getc MA_getc |
#define | putc MA_putc |
#define | ftell MA_ftell |
#define | fgetpos MA_fgetpos |
#define | fsetpos MA_fsetpos |
#define | FILE MA_FILE |
Typedefs | |
typedef MA_FILE_t | MA_FILE |
typedef unsigned int | fpos_t |
Functions | |
MA_FILE * | MA_fopen (const char *filename, const char *mode) |
int | MA_fclose (MA_FILE *stream) |
size_t | MA_fread (void *ptr, size_t size, size_t count, MA_FILE *stream) |
size_t | MA_fwrite (const void *ptr, size_t size, size_t count, MA_FILE *stream) |
int | MA_fseek (MA_FILE *stream, long int offset, int origin) |
int | MA_feof (MA_FILE *stream) |
int | MA_ferror (MA_FILE *stream) |
void | MA_rewind (MA_FILE *stream) |
int | MA_fgetc (MA_FILE *stream) |
int | MA_getc (MA_FILE *stream) |
char * | MA_fgets (char *str, int num, MA_FILE *stream) |
int | MA_fputc (int character, MA_FILE *stream) |
int | MA_putc (int character, MA_FILE *stream) |
int | MA_fputs (const char *str, MA_FILE *stream) |
long int | MA_ftell (MA_FILE *stream) |
int | MA_fgetpos (MA_FILE *stream, fpos_t *position) |
int | MA_fsetpos (MA_FILE *stream, const fpos_t *pos) |
void | setCurrentFileSystem (MAHandle fileSystem, int caseSensitive) |
void | freeCurrentFileSystem (void) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Opens the file whose name is specified in the parameter filename and associates it with a stream that can be identified in future operations by the FILE object whose pointer is returned. The operations that are allowed on the stream and how these are performed are defined by the mode parameter. Whenever writing is requested the file is represented using a store. If the file is opened as read-only the system first checks if the file exist as a store. If not it searches through the mounted file system for the file.
|
|
Closes the file associated with the stream and disassociates it. All internal buffers associated with the stream are flushed: the content of any unwritten buffer is written and the content of any unread buffer is discarded. Even if the call fails, the stream passed as parameter will no longer be associated with the file. If the file has been written to, it is saved to a store.
|
|
Read block of data from stream Reads an array of count elements, each one with a size of size bytes, from the stream and stores them in the block of memory specified by ptr. The postion indicator of the stream is advanced by the total amount of bytes read. The total amount of bytes read if successful is (size * count).
|
|
Writes an array of count elements, each one with a size of size bytes, from the block of memory pointed by ptr to the current position in the stream. The postion indicator of the stream is advanced by the total amount of bytes written. The total amount of bytes written is (size * count).
|
|
Sets the position indicator associated with the stream to a new position defined by adding offset to a reference position specified by origin. The End-of-File internal indicator of the stream is cleared after a call to this function, and all effects from previous calls to ungetc are dropped. When using fseek on text files with offset values other than zero or values retrieved with ftell, bear in mind that on some platforms some format transformations occur with text files which can lead to unexpected repositioning. On streams open for update (read+write), a call to fseek allows to switch between reading and writing.
|
|
Checks whether the End-of-File indicator associated with stream is set, returning a value different from zero if it is. This indicator is generally set by a previous operation on the stream that reached the End-of-File. Further operations on the stream once the End-of-File has been reached will fail until either rewind, fseek or fsetpos is successfully called to set the position indicator to a new value.
|
|
Checks if the error indicator associated with stream is set, returning a value different from zero if it is. This indicator is generaly set by a previous operation on the stream that failed.
|
|
Sets the position indicator associated with stream to the beginning of the file. A call to rewind is equivalent to: fseek ( stream , 0L , SEEK_SET ); except that, unlike fseek, rewind clears the error indicator. On streams open for update (read+write), a call to rewind allows to switch between reading and writing.
|
|
Returns the character currently pointed by the internal file position indicator of the specified stream. The internal file position indicator is then advanced by one character to point to the next character. fgetc and getc are equivalent, except that the latter one may be implemented as a macro.
|
|
Returns the character currently pointed by the internal file position indicator of the specified stream. The internal file position indicator is then advanced by one character to point to the next character. getc is equivalent to fgetc and also expects a stream as parameter, but getc may be implemented as a macro, so the argument passed to it should not be an expression with potential side effects. See getchar for a similar function without stream parameter.
|
|
Reads characters from stream and stores them as a C string into str until (num-1) characters have been read or either a newline or a the End-of-File is reached, whichever comes first. A newline character makes fgets stop reading, but it is considered a valid character and therefore it is included in the string copied to str. A null character is automatically appended in str after the characters read to signal the end of the C string.
|
|
Writes a character to the stream and advances the position indicator. The character is written at the current position of the stream as indicated by the internal position indicator, which is then advanced one character.
|
|
Writes a character to the stream and advances the position indicator. The character is written at the current position of the stream as indicated by the internal position indicator, which is then advanced one character. putc is equivalent to fputc and also expects a stream as parameter, but putc may be implemented as a macro, so the argument passed should not be an expression with potential side effects. See putchar for a similar function without stream parameter.
|
|
Writes the string pointed by str to the stream. The function begins copying from the address specified (str) until it reaches the terminating null character ('\0'). This final null-character is not copied to the stream.
|
|
Returns the current value of the position indicator of the stream. For binary streams, the value returned corresponds to the number of bytes from the beginning of the file. For text streams, the value is not guaranteed to be the exact number of bytes from the beginning of the file, but the value returned can still be used to restore the position indicator to this position using fseek.
|
|
Gets the information needed to uniquely identify the current value of the stream's position indicator and stores it in the location pointed by position. The parameter position should point to an already allocated object of the type fpos_t, which is only intended to be used as a paremeter in future calls to fsetpos. To retrieve the value of the internal file position indicator as an integer value, use ftell function instead.
|
|
Changes the internal file position indicator associated with stream to a new position. The position parameter is a pointer to an fpos_t object whose value shall have been previously obtained with a call to fgetpos. The End-of-File internal indicator of the stream is cleared after a call to this function, and all effects from previous calls to ungetc are dropped. On streams open for update (read+write), a call to fsetpos allows to switch between reading and writing.
|
|
Mounts a file system image, stored as a binary resource. Only one file system image may be mounted at a time. All following calls to the file api functions will use this image.
|
|
Frees the resources allocated for the current file system. |