File IO Library


Data Structures

struct  pgeDirEntry
struct  pgeDir

Typedefs

typedef struct pgeFileStruct pgeFile

Enumerations

enum  pgeFileTypes {
  PGE_FILE_TYPE_MEM = 1,
  PGE_FILE_TYPE_FILE,
  PGE_FILE_TYPE_AFILE
}
enum  pgeFileSeekTypes {
  PGE_FILE_SET = 0,
  PGE_FILE_CUR,
  PGE_FILE_END
}
enum  pgeFileFlags {
  PGE_FILE_RDONLY = PSP_O_RDONLY,
  PGE_FILE_WRONLY = PSP_O_WRONLY,
  PGE_FILE_RDWR = PSP_O_RDWR,
  PGE_FILE_APPEND = PSP_O_APPEND,
  PGE_FILE_CREATE = PSP_O_CREAT,
  PGE_FILE_TRUNC = PSP_O_TRUNC,
  PGE_FILE_ALL = PGE_FILE_RDWR|PGE_FILE_APPEND|PGE_FILE_CREATE|PGE_FILE_TRUNC
}
enum  pgeDirEntryTypes {
  PGE_DIR_ENTRY_TYPE_FILE,
  PGE_DIR_ENTRY_TYPE_DIR
}

Functions

pgeFilepgeFileOpen (char *name, int flags)
pgeFilepgeFileOpenAsync (char *name, int flags)
pgeFilepgeFileOpenMemory (char *data, int size)
int pgeFileClose (pgeFile *s)
int pgeFileRead (pgeFile *s, void *buf, unsigned int size)
int pgeFileWrite (pgeFile *s, void *buf, unsigned int size)
int pgeFileSeek (pgeFile *s, int offs, unsigned int dir)
int pgeFileTell (pgeFile *s)
int pgeFileRewind (pgeFile *s)
unsigned int pgeFileSize (pgeFile *s)
int pgeFileRemove (const char *filepath)
int pgeFileRename (const char *oldname, const char *newname)
int pgeFileExists (const char *filename)
int pgeFileMkdir (const char *name)
int pgeFileRmdir (const char *dirpath)
int pgeFileChdir (const char *path)
int pgeFileGetCwd (char *path, unsigned int size)
pgeDirpgeFileOpenDir (const char *path)
int pgeFileReadDir (pgeDir *dir)
void pgeFileCloseDir (pgeDir *dir)
int pgeFileExistsDir (const char *dirname)

Typedef Documentation

typedef struct pgeFileStruct pgeFile

A file datatype


Enumeration Type Documentation

Directory entry type enumerator

Enumerator:
PGE_DIR_ENTRY_TYPE_FILE 
PGE_DIR_ENTRY_TYPE_DIR 

File flags enumerator

Enumerator:
PGE_FILE_RDONLY 
PGE_FILE_WRONLY 
PGE_FILE_RDWR 
PGE_FILE_APPEND 
PGE_FILE_CREATE 
PGE_FILE_TRUNC 
PGE_FILE_ALL 

File seek type enumerator

Enumerator:
PGE_FILE_SET 
PGE_FILE_CUR 
PGE_FILE_END 

File type enumerator

Enumerator:
PGE_FILE_TYPE_MEM 
PGE_FILE_TYPE_FILE 
PGE_FILE_TYPE_AFILE 


Function Documentation

int pgeFileChdir ( const char *  path  ) 

Change directory.

Parameters:
path - Path to change to.
Returns:
1 on success, otherwise an error.

int pgeFileClose ( pgeFile s  ) 

Close a stream.

Parameters:
s - The stream to close.
Returns:
< 0 on error.

void pgeFileCloseDir ( pgeDir dir  ) 

Close a directory.

Parameters:
dir - A previously opened pgeDir.

int pgeFileExists ( const char *  filename  ) 

Check a file exists.

Parameters:
filename - The filename to check exists.
Returns:
1 if the file exists, else 0.

int pgeFileExistsDir ( const char *  dirname  ) 

Check a directory exists.

Parameters:
dirname - The directory to check exists.
Returns:
1 if the directory exists, else 0.

int pgeFileGetCwd ( char *  path,
unsigned int  size 
)

Get current working directory.

Parameters:
path - Pointer to the buffer to store the cwd in.
size - Size of the buffer.
Returns:
1 on success, otherwise an error.

int pgeFileMkdir ( const char *  name  ) 

Create a directory.

Parameters:
name - Name of the directory.
Returns:
1 on success, otherwise an error.

pgeFile* pgeFileOpen ( char *  name,
int  flags 
)

Open a file stream.

Parameters:
name - Path to the file.
flags - One or more of pgeFileFlags
Returns:
A pointer to a pgeFile struct or NULL on error.

pgeFile* pgeFileOpenAsync ( char *  name,
int  flags 
)

Open a file stream (async).

Parameters:
name - Path to the file.
flags - One or more of pgeFileFlags
Returns:
A pointer to a pgeFile struct or NULL on error.

pgeDir* pgeFileOpenDir ( const char *  path  ) 

Open a directory for reading.

Parameters:
path - Path to open.
Returns:
NULL on error, otherwise a pointer to a pgeDir struct.

pgeFile* pgeFileOpenMemory ( char *  data,
int  size 
)

Open a memory stream.

Parameters:
data - Pointer to the data.
flags - Size of the data in bytes.
Returns:
A pointer to a pgeFile struct or NULL on error.

int pgeFileRead ( pgeFile s,
void *  buf,
unsigned int  size 
)

Read from a stream.

Parameters:
s - The stream to read from.
buf - The buffer to read the data into.
size - Size of the read in bytes.
Returns:
Number of bytes read, < 0 on error.

int pgeFileReadDir ( pgeDir dir  ) 

Read a directory contents.

Parameters:
dir - A previously opened pgeDir.
Returns:
The number of items in the directory, < 0 on error.

int pgeFileRemove ( const char *  filepath  ) 

Remove a file.

Parameters:
filepath - Path to the file.
Returns:
1 on success, otherwise an error.

int pgeFileRename ( const char *  oldname,
const char *  newname 
)

Rename a file or directory.

Parameters:
oldname - The file or directory to rename.
newname - The new name of the file or directory.
Returns:
1 on success, otherwise an error.

int pgeFileRewind ( pgeFile s  ) 

Seek to the start of a file.

Parameters:
s - The file.
Returns:
The position within the file, < 0 on error.

int pgeFileRmdir ( const char *  dirpath  ) 

Delete a directory.

Parameters:
dirpath - Path to the directory.
Returns:
1 on success, otherwise an error.

int pgeFileSeek ( pgeFile s,
int  offs,
unsigned int  dir 
)

Seek within a stream.

Parameters:
s - The stream to seek.
offs - The stream offset.
dir - One of pgeFileSeekTypes.
Returns:
The position within the stream, < 0 on error.

unsigned int pgeFileSize ( pgeFile s  ) 

Get the size of a file.

Parameters:
s - The file.
Returns:
The size of the file.

int pgeFileTell ( pgeFile s  ) 

Get position within a stream.

Parameters:
s - The stream.
Returns:
The position within the stream, < 0 on error.

int pgeFileWrite ( pgeFile s,
void *  buf,
unsigned int  size 
)

Write to a stream.

Parameters:
s - The stream to write to.
buf - The buffer to write.
size - Size of the write in bytes.
Returns:
Number of bytes written, < 0 on error.


Generated on Mon Sep 22 16:58:14 2008 for Phoenix Game Engine by  doxygen 1.5.5