# E:/DevIL/src-IL/src/il_files.c File Reference

`#include "il_internal.h"`
`#include <stdarg.h>`

## Defines

#define | __FILES_C

## Functions

ILboolean ILAPIENTRY | iEofFile (void)
ILboolean ILAPIENTRY | iEofLump (void)
ILint ILAPIENTRY | iGetcFile (void)
ILint ILAPIENTRY | iGetcLump (void)
ILuint ILAPIENTRY | iReadFile (void *Buffer, ILuint Size, ILuint Number)
ILuint ILAPIENTRY | iReadLump (void *Buffer, const ILuint Size, const ILuint Number)
ILint ILAPIENTRY | iSeekRFile (ILint Offset, ILuint Mode)
ILint ILAPIENTRY | iSeekRLump (ILint Offset, ILuint Mode)
ILint ILAPIENTRY | iSeekWFile (ILint Offset, ILuint Mode)
ILint ILAPIENTRY | iSeekWLump (ILint Offset, ILuint Mode)
ILuint ILAPIENTRY | iTellRFile (void)
ILuint ILAPIENTRY | iTellRLump (void)
ILuint ILAPIENTRY | iTellWFile (void)
ILuint ILAPIENTRY | iTellWLump (void)
ILint ILAPIENTRY | iPutcFile (ILubyte Char)
ILint ILAPIENTRY | iPutcLump (ILubyte Char)
ILint ILAPIENTRY | iWriteFile (const void *Buffer, ILuint Size, ILuint Number)
ILint ILAPIENTRY | iWriteLump (const void *Buffer, ILuint Size, ILuint Number)
| ILHANDLE (ILAPIENTRY *iopenCopy)(ILconst_string)
| void (ILAPIENTRY *icloseCopy)(ILHANDLE)
ILint ILAPIENTRY | iSizeSeek (ILint Offset, ILuint Mode)
| Fake seek function.
ILuint ILAPIENTRY | iSizeTell (void)
ILint ILAPIENTRY | iSizePutc (ILubyte Char)
ILint ILAPIENTRY | iSizeWrite (const void *Buffer, ILuint Size, ILuint Number)
void ILAPIENTRY | iPreserveWriteFuncs ()
void ILAPIENTRY | iRestoreWriteFuncs ()
ILHANDLE ILAPIENTRY | iDefaultOpenR (ILconst_string FileName)
void ILAPIENTRY | iDefaultCloseR (ILHANDLE Handle)
ILboolean ILAPIENTRY | iDefaultEof (ILHANDLE Handle)
ILint ILAPIENTRY | iDefaultGetc (ILHANDLE Handle)
ILint ILAPIENTRY | iDefaultRead (void *Buffer, ILuint Size, ILuint Number, ILHANDLE Handle)
ILint ILAPIENTRY | iDefaultRSeek (ILHANDLE Handle, ILint Offset, ILint Mode)
ILint ILAPIENTRY | iDefaultWSeek (ILHANDLE Handle, ILint Offset, ILint Mode)
ILint ILAPIENTRY | iDefaultRTell (ILHANDLE Handle)
ILint ILAPIENTRY | iDefaultWTell (ILHANDLE Handle)
ILHANDLE ILAPIENTRY | iDefaultOpenW (ILconst_string FileName)
void ILAPIENTRY | iDefaultCloseW (ILHANDLE Handle)
ILint ILAPIENTRY | iDefaultPutc (ILubyte Char, ILHANDLE Handle)
ILint ILAPIENTRY | iDefaultWrite (const void *Buffer, ILuint Size, ILuint Number, ILHANDLE Handle)
void ILAPIENTRY | ilResetRead ()
void ILAPIENTRY | ilResetWrite ()
void ILAPIENTRY | ilSetRead (fOpenRProc Open, fCloseRProc Close, fEofProc Eof, fGetcProc Getc, fReadProc Read, fSeekRProc Seek, fTellRProc Tell)
| Allows you to override the default file-reading functions.
void ILAPIENTRY | ilSetWrite (fOpenRProc Open, fCloseRProc Close, fPutcProc Putc, fSeekWProc Seek, fTellWProc Tell, fWriteProc Write)
| Allows you to override the default file-writing functions.
void | iSetInputFile (ILHANDLE File)
void | iSetInputLump (const void *Lump, ILuint Size)
void | iSetOutputFile (ILHANDLE File)
void | iSetOutputFake (void)
void | iSetOutputLump (void *Lump, ILuint Size)
ILuint ILAPIENTRY | ilGetLumpPos ()
ILuint ILAPIENTRY | ilprintf (const char *Line,...)
void | ipad (ILuint NumZeros)
ILboolean | iPreCache (ILuint Size)
void | iUnCache ()
ILHANDLE ILAPIENTRY | iGetFile (void)
const ILubyte *ILAPIENTRY | iGetLump (void)

## Variables

ILHANDLE | FileRead = NULL
ILHANDLE | FileWrite = NULL
const void * | ReadLump = NULL
void * | WriteLump = NULL
ILuint | ReadLumpPos = 0
ILuint | ReadLumpSize = 0
ILuint | ReadFileStart = 0
ILuint | WriteFileStart = 0
ILuint | WriteLumpPos = 0
ILuint | WriteLumpSize = 0
fGetcProc | GetcProcCopy
fReadProc | ReadProcCopy
fSeekRProc | SeekProcCopy
fTellRProc | TellProcCopy
fPutcProc | PutcProcCopy
fSeekWProc | SeekWProcCopy
fTellWProc | TellWProcCopy
fWriteProc | WriteProcCopy
ILboolean | UseCache = IL_FALSE
ILubyte * | Cache = NULL
ILuint | CacheSize
ILuint | CachePos
ILuint | CacheStartPos
ILuint | CacheBytesRead

## Define Documentation

#define __FILES_C

## Function Documentation

void ILAPIENTRY iDefaultCloseR | ( | ILHANDLE | Handle | ) |

Referenced by ilResetRead().

void ILAPIENTRY iDefaultCloseW | ( | ILHANDLE | Handle | ) |

Referenced by ilResetWrite().

ILboolean ILAPIENTRY iDefaultEof | ( | ILHANDLE | Handle | ) |

Referenced by ilResetRead().

ILint ILAPIENTRY iDefaultGetc | ( | ILHANDLE | Handle | ) |

Referenced by ilResetRead().

ILHANDLE ILAPIENTRY iDefaultOpenR | ( | ILconst_string | FileName | ) |

Referenced by ilResetRead().

ILHANDLE ILAPIENTRY iDefaultOpenW | ( | ILconst_string | FileName | ) |

Referenced by ilResetWrite().

ILint ILAPIENTRY iDefaultPutc | ( | ILubyte | Char,
|  | ILHANDLE | Handle |
| ) |  |  |

Referenced by ilResetWrite().

ILint ILAPIENTRY iDefaultRead | ( | void * | Buffer,
|  | ILuint | Size,
|  | ILuint | Number,
|  | ILHANDLE | Handle |
| ) |  |  |

Referenced by ilResetRead().

ILint ILAPIENTRY iDefaultRSeek | ( | ILHANDLE | Handle,
|  | ILint | Offset,
|  | ILint | Mode |
| ) |  |  |

Referenced by ilResetRead().

ILint ILAPIENTRY iDefaultRTell | ( | ILHANDLE | Handle | ) |

Referenced by ilResetRead().

ILint ILAPIENTRY iDefaultWrite | ( | const void * | Buffer,
|  | ILuint | Size,
|  | ILuint | Number,
|  | ILHANDLE | Handle |
| ) |  |  |

Referenced by ilResetWrite().

ILint ILAPIENTRY iDefaultWSeek | ( | ILHANDLE | Handle,
|  | ILint | Offset,
|  | ILint | Mode |
| ) |  |  |

Referenced by ilResetWrite().

ILint ILAPIENTRY iDefaultWTell | ( | ILHANDLE | Handle | ) |

Referenced by ilResetWrite().

ILboolean ILAPIENTRY iEofFile | ( | void |  | ) |

Referenced by iSetInputFile().

ILboolean ILAPIENTRY iEofLump | ( | void |  | ) |

Referenced by iSetInputLump().

ILint ILAPIENTRY iGetcFile | ( | void |  | ) |

Referenced by iSetInputFile().

ILint ILAPIENTRY iGetcLump | ( | void |  | ) |

Referenced by iSetInputLump().

ILHANDLE ILAPIENTRY iGetFile | ( | void |  | ) |

Referenced by iLoadSunInternal(), and iLoadWbmpInternal().

const ILubyte* ILAPIENTRY iGetLump | ( | void |  | ) |

ILuint ILAPIENTRY ilGetLumpPos | ( | void |  | ) |

ILHANDLE | ( | ILAPIENTRY * | iopenCopy | ) | const

ILuint ILAPIENTRY ilprintf | ( | const char * | Line,
|  |  | ... |
| ) |  |  |

Referenced by iSavePnmInternal(), and RGBE_WriteHeader().

void ILAPIENTRY ilResetRead | ( | void |  | ) |

Referenced by ilInit().

void ILAPIENTRY ilResetWrite | ( | void |  | ) |

Referenced by ilInit(), and iPreserveWriteFuncs().

void ILAPIENTRY ilSetRead | ( | fOpenRProc | Open,
|  | fCloseRProc | Close,
|  | fEofProc | Eof,
|  | fGetcProc | Getc,
|  | fReadProc | Read,
|  | fSeekRProc | Seek,
|  | fTellRProc | Tell |
| ) |  |  |

Allows you to override the default file-reading functions.

Referenced by ilResetRead().

void ILAPIENTRY ilSetWrite | ( | fOpenRProc | Open,
|  | fCloseRProc | Close,
|  | fPutcProc | Putc,
|  | fSeekWProc | Seek,
|  | fTellWProc | Tell,
|  | fWriteProc | Write |
| ) |  |  |

Allows you to override the default file-writing functions.

Referenced by ilResetWrite().

void ipad | ( | ILuint | NumZeros | ) |

Referenced by iSaveTargaInternal().

ILboolean iPreCache | ( | ILuint | Size | ) |

Referenced by iGetcFile(), iLoadHdrInternal(), ilReadUncompBmp(), iReadFile(), iReadNonRleSgi(), iUncompressDcx(), iUncompressPcx(), iUncompressSmall(), and iUncompressTgaData().

void ILAPIENTRY iPreserveWriteFuncs | ( | void |  | ) |

ILint ILAPIENTRY iPutcFile | ( | ILubyte | Char | ) |

Referenced by iSetOutputFile().

ILint ILAPIENTRY iPutcLump | ( | ILubyte | Char | ) |

Referenced by iSetOutputLump().

ILuint ILAPIENTRY iReadFile | ( | void * | Buffer,
|  | ILuint | Size,
|  | ILuint | Number |
| ) |  |  |

Referenced by iSetInputFile().

ILuint ILAPIENTRY iReadLump | ( | void * | Buffer,
|  | const ILuint | Size,
|  | const ILuint | Number |
| ) |  |  |

Referenced by iPreCache(), iSetInputLump(), and iUnCache().

void ILAPIENTRY iRestoreWriteFuncs | ( | void |  | ) |

ILint ILAPIENTRY iSeekRFile | ( | ILint | Offset,
|  | ILuint | Mode |
| ) |  |  |

Referenced by iSetInputFile().

ILint ILAPIENTRY iSeekRLump | ( | ILint | Offset,
|  | ILuint | Mode |
| ) |  |  |

Referenced by iSetInputLump().

ILint ILAPIENTRY iSeekWFile | ( | ILint | Offset,
|  | ILuint | Mode |
| ) |  |  |

Referenced by iSetOutputFile().

ILint ILAPIENTRY iSeekWLump | ( | ILint | Offset,
|  | ILuint | Mode |
| ) |  |  |

Referenced by iSetOutputLump().

void iSetInputFile | ( | ILHANDLE | File | ) |

Referenced by ilIsValidBmpF(), ilIsValidDcxF(), ilIsValidDdsF(), ilIsValidExrF(), ilIsValidGifF(), ilIsValidHdrF(), ilIsValidIcnsF(), ilIsValidJp2F(), ilIsValidJpegF(), ilIsValidLifF(), ilIsValidMdlF(), ilIsValidPcxF(), ilIsValidPicF(), ilIsValidPngF(), ilIsValidPnmF(), ilIsValidPsdF(), ilIsValidPspF(), ilIsValidSgiF(), ilIsValidSunF(), ilIsValidTgaF(), ilIsValidTiffF(), ilIsValidTplF(), ilIsValidVtfF(), ilIsValidWdpF(), ilIsValidXpmF(), ilLoadBmpF(), ilLoadCutF(), ilLoadDataF(), ilLoadDcxF(), ilLoadDdsF(), ilLoadDoomF(), ilLoadDoomFlatF(), ilLoadExrF(), ilLoadGifF(), ilLoadHdrF(), ilLoadIcnsF(), ilLoadIconF(), ilLoadIffF(), ilLoadJp2F(), ilLoadJpegF(), ilLoadLifF(), ilLoadMdlF(), ilLoadMngF(), ilLoadPcdF(), ilLoadPcxF(), ilLoadPicF(), ilLoadPixF(), ilLoadPngF(), ilLoadPnmF(), ilLoadPsdF(), ilLoadPspF(), ilLoadPxrF(), ilLoadRawF(), ilLoadSgiF(), ilLoadSun(), ilLoadSunF(), ilLoadTargaF(), ilLoadTiffF(), ilLoadTplF(), ilLoadVtfF(), ilLoadWalF(), ilLoadWbmp(), ilLoadWbmpF(), ilLoadWdpF(), ilLoadXpm(), and ilLoadXpmF().

void iSetInputLump | ( | const void * | Lump,
|  | ILuint | Size |
| ) |  |  |

Referenced by ilIsValidBmpL(), ilIsValidDcxL(), ilIsValidDdsL(), ilIsValidExrL(), ilIsValidGifL(), ilIsValidHdrL(), ilIsValidIcnsL(), ilIsValidJp2L(), ilIsValidJpegL(), ilIsValidLifL(), ilIsValidMdlL(), ilIsValidPcxL(), ilIsValidPicL(), ilIsValidPngL(), ilIsValidPnmL(), ilIsValidPsdL(), ilIsValidPspL(), ilIsValidSgiL(), ilIsValidSunL(), ilIsValidTgaL(), ilIsValidTiffL(), ilIsValidTplL(), ilIsValidVtfL(), ilIsValidWdpL(), ilIsValidXpmL(), ilLoadBmpL(), ilLoadCutL(), ilLoadDataL(), ilLoadDcxL(), ilLoadDdsL(), ilLoadDoomFlatL(), ilLoadDoomL(), ilLoadExrL(), ilLoadGifL(), ilLoadHdrL(), ilLoadIcnsL(), ilLoadIconL(), ilLoadIffL(), ilLoadJpegL(), ilLoadLifL(), ilLoadMdlL(), ilLoadMngL(), ilLoadPcdL(), ilLoadPcxL(), ilLoadPicL(), ilLoadPixL(), ilLoadPngL(), ilLoadPnmL(), ilLoadPsdL(), ilLoadPspL(), ilLoadPxrL(), ilLoadRawL(), ilLoadSgiL(), ilLoadSunL(), ilLoadTargaL(), ilLoadTiffL(), ilLoadTplL(), ilLoadVtfL(), ilLoadWalL(), ilLoadWbmpL(), ilLoadWdpL(), and ilLoadXpmL().

void iSetOutputFake | ( | void |  | ) |

Referenced by ilDetermineSize().

void iSetOutputFile | ( | ILHANDLE | File | ) |

Referenced by ilSaveBmpF(), ilSaveDdsF(), ilSaveExrF(), ilSaveHdrF(), ilSaveJp2F(), ilSaveJpegF(), ilSaveMngF(), ilSavePcxF(), ilSavePngF(), ilSavePnmF(), ilSavePsdF(), ilSaveRawF(), ilSaveSgiF(), ilSaveTargaF(), ilSaveTiffF(), and ilSaveWbmpF().

void iSetOutputLump | ( | void * | Lump,
|  | ILuint | Size |
| ) |  |  |

Referenced by ilGetDXTCData(), ilSaveBmpL(), ilSaveDdsL(), ilSaveExrL(), ilSaveHdrL(), ilSaveJp2L(), ilSaveJpegL(), ilSaveMngL(), ilSavePcxL(), ilSavePngL(), ilSavePnmL(), ilSavePsdL(), ilSaveRawL(), ilSaveSgiL(), ilSaveTargaL(), ilSaveTiffL(), and ilSaveWbmpL().

ILint ILAPIENTRY iSizePutc | ( | ILubyte | Char | ) |

Referenced by iSetOutputFake().

ILint ILAPIENTRY iSizeSeek | ( | ILint | Offset,
|  | ILuint | Mode |
| ) |  |  |

Fake seek function.

Referenced by iSetOutputFake().

ILuint ILAPIENTRY iSizeTell | ( | void |  | ) |

Referenced by iSetOutputFake().

ILint ILAPIENTRY iSizeWrite | ( | const void * | Buffer,
|  | ILuint | Size,
|  | ILuint | Number |
| ) |  |  |

Referenced by iSetOutputFake().

ILuint ILAPIENTRY iTellRFile | ( | void |  | ) |

Referenced by iSetInputFile().

ILuint ILAPIENTRY iTellRLump | ( | void |  | ) |

Referenced by iSetInputLump().

ILuint ILAPIENTRY iTellWFile | ( | void |  | ) |

Referenced by iSetOutputFile().

ILuint ILAPIENTRY iTellWLump | ( | void |  | ) |

Referenced by iSetOutputLump().

void iUnCache | ( | void |  | ) |

Referenced by iLoadHdrInternal(), ilReadUncompBmp(), iReadNonRleSgi(), iUncompressDcx(), iUncompressPcx(), iUncompressSmall(), and iUncompressTgaData().

ILint ILAPIENTRY iWriteFile | ( | const void * | Buffer,
|  | ILuint | Size,
|  | ILuint | Number |
| ) |  |  |

Referenced by iSetOutputFile().

ILint ILAPIENTRY iWriteLump | ( | const void * | Buffer,
|  | ILuint | Size,
|  | ILuint | Number |
| ) |  |  |

Referenced by iSetOutputLump().

__FILES_EXTERN void | ( | ILAPIENTRY * | icloseCopy | ) |

Referenced by ilFlipSurfaceDxtcData(), ilInvertSurfaceDxtcDataAlpha(), ilSaveFromJpegStruct(), iSaveJpegInternal(), png_write(), and readScanlines().

## Variable Documentation

ILubyte* Cache = NULL

Referenced by iGetcFile(), iPreCache(), iReadFile(), iReadNonRleSgi(), and iUnCache().

ILuint CacheBytesRead

Referenced by iGetcFile(), iPreCache(), iReadFile(), and iUnCache().

ILuint CachePos

Referenced by iGetcFile(), iPreCache(), iReadFile(), and iUnCache().

ILuint CacheSize

Referenced by iGetcFile(), iPreCache(), iReadFile(), and iUnCache().

ILuint CacheStartPos

Referenced by iPreCache(), and iUnCache().

ILHANDLE FileRead = NULL

Referenced by iEofFile(), iGetcFile(), iGetFile(), iReadFile(), iSeekRFile(), iSetInputFile(), and iTellRFile().

ILHANDLE FileWrite = NULL

Referenced by iPutcFile(), iSeekWFile(), iSetOutputFile(), iTellWFile(), and iWriteFile().

fGetcProc GetcProcCopy

fPutcProc PutcProcCopy

Referenced by iPreserveWriteFuncs(), and iRestoreWriteFuncs().

ILuint ReadFileStart = 0

Referenced by iSeekRFile(), and iSetInputFile().

const void* ReadLump = NULL

Referenced by iGetcLump(), iGetLump(), iReadLump(), and iSetInputLump().

ILuint ReadLumpPos = 0

Referenced by iEofLump(), iGetcLump(), iReadLump(), iSeekRLump(), iSetInputLump(), and iTellRLump().

ILuint ReadLumpSize = 0

Referenced by iEofLump(), iGetcLump(), iReadLump(), iSeekRLump(), and iSetInputLump().

fReadProc ReadProcCopy

fSeekRProc SeekProcCopy

fSeekWProc SeekWProcCopy

Referenced by iPreserveWriteFuncs(), and iRestoreWriteFuncs().

fTellRProc TellProcCopy

fTellWProc TellWProcCopy

Referenced by iPreserveWriteFuncs(), and iRestoreWriteFuncs().

ILboolean UseCache = IL_FALSE

Referenced by iDefaultGetc(), iGetcFile(), iPreCache(), iReadFile(), and iUnCache().

ILuint WriteFileStart = 0

Referenced by iSeekWFile().

void* WriteLump = NULL

Referenced by ilGetLumpPos(), iPutcLump(), iSetOutputFile(), iSetOutputLump(), and iWriteLump().

ILuint WriteLumpPos = 0

Referenced by ilGetLumpPos(), iPutcLump(), iSeekWLump(), iSetOutputFile(), iSetOutputLump(), iTellWLump(), and iWriteLump().

ILuint WriteLumpSize = 0

Referenced by iPutcLump(), iSeekWLump(), iSetOutputFile(), iSetOutputLump(), and iWriteLump().

fWriteProc WriteProcCopy

Referenced by iPreserveWriteFuncs(), and iRestoreWriteFuncs().