18 <div class=
"CFunction"><div class=CTopic
><h3 class=CTitle
><a name=
"alureSetIOCallbacks"></a>alureSetIOCallbacks
</h3><div class=CBody
><blockquote><table border=
0 cellspacing=
0 cellpadding=
0 class=Prototype
><tr><td><table border=
0 cellspacing=
0 cellpadding=
0><tr><td class=PBeforeParameters colspan=
4>ALURE_API ALboolean ALURE_APIENTRY alureSetIOCallbacks(
</td></tr><tr><td> </td><td class=PType nowrap
>void
</td><td class=PParameterPrefix nowrap
>*
</td><td class=PParameter nowrap width=
100%
>(*open)(const char *filename, ALuint mode),
</td></tr><tr><td> </td><td class=PType nowrap
>void
</td><td class=PParameterPrefix nowrap
></td><td class=PParameter nowrap width=
100%
>(*close)(void *handle),
</td></tr><tr><td> </td><td class=PType nowrap
>ALsizei
</td><td class=PParameterPrefix nowrap
></td><td class=PParameter nowrap width=
100%
>(*read)(void *handle, ALubyte *buf, ALuint bytes),
</td></tr><tr><td> </td><td class=PType nowrap
>ALsizei
</td><td class=PParameterPrefix nowrap
></td><td class=PParameter nowrap width=
100%
>(*write)(void *handle, const ALubyte *buf, ALuint bytes),
</td></tr><tr><td> </td><td class=PType nowrap
>alureInt64
</td><td class=PParameterPrefix nowrap
></td><td class=PParameter nowrap width=
100%
>(*seek)(void *handle, alureInt64 offset, int whence)
</td></tr><tr><td class=PAfterParameters colspan=
4>)
</td></tr></table></td></tr></table></blockquote><p>Provides callbacks for alternative methods to handle file I/O.
Passing NULL for all callbacks is a valid way to revert to normal I/O, otherwise they must all be specified.
Changing the callbacks will not affect open files (they will continue using the callbacks that were set at the time they were opened).
</p><h4 class=CHeading
>Parameters
</h4><table border=
0 cellspacing=
0 cellpadding=
0 class=CDescriptionList
><tr><td class=CDLEntry
>open
</td><td class=CDLDescription
>This callback is called to open the named file.
The given mode is the access rights the open file should have.
Currently, this will always be
0 for read-only (applications should check this to make sure, as future versions may pass other values for other modes).
Upon success, a non-NULL handle must be returned which will be used as a unique identifier for the file.
</td></tr><tr><td class=CDLEntry
>close
</td><td class=CDLDescription
>This callback is called to close an opened file handle.
The handle will no longer be used after this function.
</td></tr><tr><td class=CDLEntry
>read
</td><td class=CDLDescription
>This callback is called when data needs to be read from the given handle.
Up to the given number of bytes should be copied into
‘buf
’ and the number of bytes actually copied should be returned.
Returning
0 means the end of the file has been reached (so non-blocking I/O methods should ensure at least
1 byte gets read), and negative indicates an error.
</td></tr><tr><td class=CDLEntry
>write
</td><td class=CDLDescription
>This callback is called when data needs to be written to the given handle.
Up to the given number of bytes should be copied from
‘buf
’ and the number of bytes actually copied should be returned.
A return value of
0 means no more data can be written (so non-blocking I/O methods should ensure at least
1 byte gets written), and negative indicates an error.
</td></tr><tr><td class=CDLEntry
>seek
</td><td class=CDLDescription
>This callback is called to reposition the offset of the file handle.
The given offset is interpreted according to
‘whence
’, which may be SEEK_SET (absolute position from the start of the file), SEEK_CUR (relative position from the current offset), or SEEK_END (absolute position from the end of the file), as defined by standard C.
The new offset from the beginning of the file should be returned.
If the file cannot seek, such as when using a FIFO, -
1 should be returned.
</td></tr></table><h4 class=CHeading
>Returns
</h4><p>AL_FALSE on error.
</p><p><b>Version Added
</b>:
1.1</p></div></div></div>
33 <div class=CToolTip
id=
"tt1"><div class=CFunction
><blockquote><table border=
0 cellspacing=
0 cellpadding=
0 class=Prototype
><tr><td><table border=
0 cellspacing=
0 cellpadding=
0><tr><td class=PBeforeParameters colspan=
4>ALURE_API ALboolean ALURE_APIENTRY alureSetIOCallbacks(
</td></tr><tr><td> </td><td class=PType nowrap
>void
</td><td class=PParameterPrefix nowrap
>*
</td><td class=PParameter nowrap width=
100%
>(*open)(const char *filename, ALuint mode),
</td></tr><tr><td> </td><td class=PType nowrap
>void
</td><td class=PParameterPrefix nowrap
></td><td class=PParameter nowrap width=
100%
>(*close)(void *handle),
</td></tr><tr><td> </td><td class=PType nowrap
>ALsizei
</td><td class=PParameterPrefix nowrap
></td><td class=PParameter nowrap width=
100%
>(*read)(void *handle, ALubyte *buf, ALuint bytes),
</td></tr><tr><td> </td><td class=PType nowrap
>ALsizei
</td><td class=PParameterPrefix nowrap
></td><td class=PParameter nowrap width=
100%
>(*write)(void *handle, const ALubyte *buf, ALuint bytes),
</td></tr><tr><td> </td><td class=PType nowrap
>alureInt64
</td><td class=PParameterPrefix nowrap
></td><td class=PParameter nowrap width=
100%
>(*seek)(void *handle, alureInt64 offset, int whence)
</td></tr><tr><td class=PAfterParameters colspan=
4>)
</td></tr></table></td></tr></table></blockquote>Provides callbacks for alternative methods to handle file I/O.
</div></div><!--END_ND_TOOLTIPS-->