- Main Page
- Classes
- Files

- File List
- File Members

# flFile.h

Go to the documentation of this file.

    00001 // Funclib File v1.0.0 (CORE)
    00002 //
    00003 // This module contains wrapper functions for file manipulation,
    00004 // it also contains other useful filesystem functions.
    00005 //
    00006 // Contributor(s): Flatmush
    00007
    00008
    00009
    00010 #ifndef FLFILE_H
    00011 #define FLFILE_H
    00012
    00013 #include "flGlobal.h"
    00014
    00015 #if FL_FILE != 0
    00016
    00017 #ifdef __cplusplus
    00018 extern "C" {
    00019 #endif
    00020
    00021 #define FILE_MODE_APPEND    (0)
    00022 #define FILE_MODE_READ      (1)
    00023 #define FILE_MODE_WRITE     (2)
    00024 #define FILE_MODE_BINARY    (4)
    00025 #define FILE_MODE_READWRITE (8)
    00026
    00027 #define FILE_TYPE_FILE      (0)
    00028 #define FILE_TYPE_MEMORY    (1)
    00029 #define FILE_TYPE_ZIP       (2)
    00030 #define FILE_TYPE_PBP       (3) // Compatible with PBP Plus files too.
    00031
    00032 #define FILE_STATE_NORMAL   (0)
    00033 #define FILE_STATE_EOF      (1)
    00034 #define FILE_STATE_ERROR    (2)
    00035
    00036 #define FILE_SEEK_SET    (SEEK_SET)
    00037 #define FILE_SEEK_CUR    (SEEK_CUR)
    00038 #define FILE_SEEK_END    (SEEK_END)
    00039
    00040 #define FILE_COPY_BLOCKSIZE 16384
    00041
    00042 typedef struct {
    00043      char fseName[128];
    00044 } FileDirEntry;
    00045
    00046 typedef struct {
    00047      char* filePath;
    00048      u8*   fileData;
    00049      int   filePointer;
    00050      int   fileSize;
    00051      u8    fileMode;
    00052      u8    fileType;
    00053      u8    fileState;
    00054      u8    filePadding;
    00055 } File;
    00056
    00057 extern File* fileOpen(char* inPath, u8 inMode);
    00058 extern void  fileClose(File* inFile);
    00059 extern bool  fileCheckState(File* inFile);
    00060 extern void  fileSeek(File* inFile, long inSeek, int inMode);
    00061 extern int   fileRead(void* inDest, int inSize, File* inFile);
    00062 extern int   fileWrite(void* inSrc, int inSize, File* inFile);
    00063 extern int   filePuts(char* inString, File* inFile);
    00064 extern char* fileGets(char* inString, int inCount, File* inFile);
    00065 extern bool  fileEOF(File* inFile);
    00066 extern bool  fileError(File* inFile);
    00067
    00068 extern char  fileTypeGet(char* inPath);
    00069 extern bool  fileExists(char* inPath);
    00070 extern char* fileNameFromPath(char* inPath);
    00071 extern char* fileExtension(char* inPath);
    00072 extern char* filePathValidate(char* inPath);
    00073 extern bool  fileMkdir(char* inDir);
    00074 extern bool  fileDelete(char* inPath);
    00075 extern bool  fileCopy(char* inSrc, char* inDest);
    00076
    00077 #ifdef __cplusplus
    00078 }
    00079 #endif
    00080
    00081 #else
    00082
    00083 #include <stdio.h>
    00084 #include <pspkernel.h>
    00085
    00086 #define FILE_SEEK_SET    (SEEK_SET)
    00087 #define FILE_SEEK_CUR    (SEEK_CUR)
    00088 #define FILE_SEEK_END    (SEEK_END)
    00089
    00090 #define fileClose(inFile) fclose(inFile)
    00091 #define fileRead(inDest, inSize, inFile) fread(inDest, 1, inSize, inFile)
    00092 #define fileWrite(inSrc, inSize, inFile) fwrite(inSrc, 1, inSize, inFile)
    00093 #define filePuts(inString, inFile) fputs(inString, inFile)
    00094 #define fileGets(inString, inCount, inFile) fgets(inString, inCount, inFile)
    00095 #define fileSeek(inFile, inSeek, inMode) fseek(inFile, inSeek, inMode)
    00096 #define fileEOF(inFile) feof(inFile)
    00097 #define fileError(inFile) ferror(inFile)
    00098
    00099 #define fileDelete(inPath) sceIoRemove(inPath)
    00100
    00101 #endif
    00102
    00103 #endif