My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Macros | Typedefs | Functions | Variables
sw_filelib.h File Reference
#include "sw_types.h"

Go to the source code of this file.

Classes

struct  _FILE_CON
 

Macros

#define SW_READ   0x001
 
#define SW_WRITE   0x002
 
#define SW_RDWR   (SW_READ | SW_WRITE)
 
#define SW_CREATE_NEW   0x004
 
#define SW_CREATE_ALWAYS   0x008
 
#define SW_APPEND   0x010
 
#define SW_UNBUF   0x004
 
#define SW_EOF   0x010
 
#define SW_ERROR   0x020
 
#define SW_IOFIFO   0x40
 
#define SW_MYBUF   0x008
 
#define SW_IOLBF   0x040
 
#define L(n)   ((long) (n))
 
#define SW_FILEOPEN_MAX   20
 
#define SIZE_BUF   1024
 
#define EOF   (-1)
 
#define _ERROR_NO_H_
 
#define ENOENT   2 /* No such file or directory */
 
#define ENOMEM   12 /* Out of memory */
 
#define EACCES   13 /* Permission denied */
 
#define ENOSPC   28 /* No space on device*/
 
#define stdin   (&BUF_IO[0])
 
#define stdout   (&BUF_IO[1])
 
#define stderr   (&BUF_IO[2])
 

Typedefs

typedef struct _FILE_CON FILE
 

Functions

int() feof (FILE *file_stream)
 feof - Checks whether the end-of-File indicator associated with stream is set More...
 
FILEfopen (const unsigned char *name, const unsigned char *mode)
 function shall open the file whose pathname is the string pointed to by filename, and associates a stream with it More...
 
unsigned int fread (void *out_buf, unsigned int size, unsigned int count, FILE *inputstream)
 Reads an array of count elements from an inputstream. More...
 
unsigned int fwrite (const void *content, unsigned int size, unsigned int count, FILE *pfile)
 fwrite - Writes an array of count elements to an outputstream More...
 
int fseek (FILE *seekstream, long offset, int whence)
 fseek - Sets the position indicator associated with the stream to a new position More...
 
int fclose (FILE *pfile)
 fclose - function will flushes the stream pointed to by filepointer More...
 
int remove (const char *r_pth)
 remove - Deletes the file whose name is specified in filename More...
 

Variables

int errno
 
FILE BUF_IO [SW_FILEOPEN_MAX]
 

Macro Definition Documentation

#define _ERROR_NO_H_
#define EACCES   13 /* Permission denied */
#define ENOENT   2 /* No such file or directory */
#define ENOMEM   12 /* Out of memory */
#define ENOSPC   28 /* No space on device*/
#define EOF   (-1)
#define L (   n)    ((long) (n))
#define SIZE_BUF   1024
#define stderr   (&BUF_IO[2])
#define stdin   (&BUF_IO[0])
#define stdout   (&BUF_IO[1])
#define SW_APPEND   0x010
#define SW_CREATE_ALWAYS   0x008
#define SW_CREATE_NEW   0x004
#define SW_EOF   0x010
#define SW_ERROR   0x020
#define SW_FILEOPEN_MAX   20
#define SW_IOFIFO   0x40
#define SW_IOLBF   0x040
#define SW_MYBUF   0x008
#define SW_RDWR   (SW_READ | SW_WRITE)
#define SW_READ   0x001
#define SW_UNBUF   0x004
#define SW_WRITE   0x002

Typedef Documentation

typedef struct _FILE_CON FILE

Function Documentation

int fclose ( FILE pfile)

fclose - function will flushes the stream pointed to by filepointer

Parameters
pfile- Pointer to a FILE object that specifies the stream to be closed
Returns
- If the stream is successfully closed, a zero value is returned. On failure, EOF is returned
int() feof ( FILE file_stream)

feof - Checks whether the end-of-File indicator associated with stream is set

Parameters
file_stream- Pointer to a FILE object that identifies the stream
Returns
- A non-zero value is returned in the case that the end-of-file indicator associated with the stream is set.Otherwise, zero is returned
FILE* fopen ( const unsigned char *  name,
const unsigned char *  mode 
)

function shall open the file whose pathname is the string pointed to by filename, and associates a stream with it

Parameters
name- string containing the name of the file to be opened
mode- string containing a file access mode
Returns
- Upon successful completion, fopen() shall return a pointer to the object controlling the stream. Otherwise, a null pointer shall be returned
unsigned int fread ( void *  out_buf,
unsigned int  size,
unsigned int  count,
FILE inputstream 
)

Reads an array of count elements from an inputstream.

Parameters
out_buf- Pointer to a block of memory with a size of at least (size*count) bytes
size- Size in bytes, of each element to be read
count- Number of elements, each one with a size of size bytes
inputstream- Pointer to a FILE object that specifies an input stream
Returns
- The total number of elements successfully read is returned if this number differs from the count parameter, either a reading error occurred or the end-of-file was reached while reading. In both cases, -1 is returned
int fseek ( FILE seekstream,
long  offset,
int  whence 
)

fseek - Sets the position indicator associated with the stream to a new position

Parameters
seekstream- Pointer to a FILE object that identifies the stream
offset- Number of bytes to offset from origin
whence- Position used as reference for the offset for reference sw_filelibc.h
Returns
- If successful, the function returns zero. Otherwise, it returns non-zero value
unsigned int fwrite ( const void *  content,
unsigned int  size,
unsigned int  count,
FILE pfile 
)

fwrite - Writes an array of count elements to an outputstream

Parameters
content- Pointer to the array of elements to be written
size- Size in bytes of each element to be written
count- Number of elements, each one with a size of size bytes
pfile- Pointer to a FILE object that specifies an output stream
Returns
- The total number of elements successfully written is returned. If this number differs from the count parameter -1 is returned
int remove ( const char *  r_pth)

remove - Deletes the file whose name is specified in filename

Parameters
r_pth- string containing the name of the file to be deleted
Returns
- if the file is successfully deleted, a zero value is returned. On failure, a non-zero value is returned

Variable Documentation

int errno