libktx Reference 4.3.2
Libraries and tools to create and read KTX image texture files.
Loading...
Searching...
No Matches
filestream.c File Reference

Implementation of ktxStream for FILE. More...

#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "ktx.h"
#include "ktxint.h"
#include "filestream.h"

Functions

KTX_error_code ktxFileStream_construct (ktxStream *str, FILE *file, ktx_bool_t closeFileOnDestruct)
 Initialize a ktxFileStream.
 
void ktxFileStream_destruct (ktxStream *str)
 Destruct the stream, potentially closing the underlying FILE.
 

Detailed Description

Implementation of ktxStream for FILE.

Author
Maksim Kolesin, Under Development
Georg Kolling, Imagination Technology
Mark Callow, HI Corporation

Function Documentation

◆ ktxFileStream_construct()

KTX_error_code ktxFileStream_construct ( ktxStream str,
FILE *  file,
ktx_bool_t  closeFileOnDestruct 
)

Initialize a ktxFileStream.

Parameters
[in]strpointer to the ktxStream to initialize.
[in]filepointer to the underlying FILE object.
[in]closeFileOnDestructif not false, stdio file pointer will be closed when ktxStream is destructed.
Returns
KTX_SUCCESS on success, KTX_INVALID_VALUE on error.
Exceptions
KTX_INVALID_VALUEstream is NULL or file is NULL.

◆ ktxFileStream_destruct()

void ktxFileStream_destruct ( ktxStream str)

Destruct the stream, potentially closing the underlying FILE.

This only closes the underyling FILE if the closeOnDestruct parameter to ktxFileStream_construct() was not KTX_FALSE.

Parameters
[in]strpointer to the ktxStream whose FILE is to potentially be closed.