HDF5 Extras  0.0.1
Convenience Functions for using HDF5 Better
Data Structures | Macros | Functions
ifile.h File Reference
#include <hdf5.h>
#include <sqlite3.h>
#include <string.h>
#include "globals.h"

Go to the source code of this file.

Data Structures

struct  IFILE
 

Macros

#define IFILE_CLOSED   0
 
#define IFILE_R   1
 
#define IFILE_W   2
 
#define IFILE_A   3
 
#define IFILE_RP   4
 
#define IFILE_WP   5
 
#define IFILE_AP   6
 
#define IFILE_WX   7
 
#define IFILE_WXP   8
 
#define IFILE_SUCCESS   1
 
#define IFILE_FAILURE   2
 

Functions

IFILEIFileOpen (hid_t file_id, const char *ifilename, const char *access)
 IFileOpen is used to open an internal file in a GeoSci File. More...
 
int IFileClearError (IFILE *ifilep)
 IFileClearError clears the error condition on an internal file. More...
 
int IFileClose (IFILE *ifilep)
 IFileClose closes an internal file in a GeoSci File. More...
 
int IFileEOF (IFILE *ifilep)
 IFileEOF returns the End-Of-File condition of the previous internal read. More...
 
int IFileError (IFILE *ifilep)
 IFileError returns error condition on an internal file. More...
 
int IFileFlush (IFILE *ifilep)
 IFileFlush flushes unwritten buffers to an internal file in a GeoSci File. More...
 
int IFileGetc (IFILE *ifilep)
 IFileGetc reads a character from an internal file. More...
 
char * IFileGets (IFILE *ifilep, char *str, int num)
 IFileGets reads characters from an internal file in a geosci file, and stores them as a string until the maximum number of characters have been read or either a newline or the end-of-file is reached, whichever happens first. More...
 
int IFileSeek (IFILE *ifilep, long int offset, int origin)
 IFileSeek moves to a position in an internal file. More...
 
long int IFileTell (IFILE *ifilep)
 IFileTell retrieves the current read/write position in an internal file. More...
 
int IFileRewind (IFILE *ifilep)
 IFileRewind moves to the start of an internal file. More...
 
int IFilePerror (IFILE *ifilep, const char *str)
 IFilePerror prints latest error for an internal file. More...
 
int IFileReadAccess (IFILE *ifilep)
 IFileReadAccess reads access code of an internal file. More...
 
int IFileReadAccessHDF (hid_t dataset_id)
 IFileReadAccessHDF reads access code of an internal file. More...
 
int IFileWriteAccess (IFILE *ifilep, int code)
 IFileWriteAccess writes a new access code for an internal file. More...
 
int IFileAllocate (IFILE *ifilep, long int offset, long int length)
 IFileAllocate is used to allocate more space to an internal file. More...
 
int IFilePrintf (IFILE *ifilep, const char *format,...)
 IFilePrintf writes formatted data to an internal file. More...
 
int IFilePutc (IFILE *ifilep, char character)
 IFilePutc writes a single character to an internal file. More...
 
int IFilePuts (IFILE *ifilep, const char *string)
 IFilePuts writes a string to an internal file. More...
 
size_t IFileRead (IFILE *ifilep, void *buf, int size, int count)
 IFileRead reads the requested number of bytes from an internal file in a geosci file. More...
 
int IFileReadStatus (IFILE *ifilep, char **message)
 IFileReadStatus reads the status properties of an internal file. More...
 
int IFileWriteStatus (IFILE *ifilep, int status, const char *message)
 IFileWriteStatus writes the status properties of an internal file. More...
 
int IFileWriteStatusMessage (IFILE *ifilep, const char *message)
 IFileWriteStatusMessage writes the status message of an internal file. More...
 
int IFileScanf (IFILE *ifilep, const char *format,...)
 IFileScanf reads formatted data from an internal file. More...
 
int IFileSetEOF (IFILE *ifilep, int value)
 IFileSetEOF sets End-Of-File condition on an internal file. More...
 
int IFileSetWriteability (hid_t file_id, const char *name, int property)
 IFileSetWriteability sets the read/write property of an internal file. More...
 
int IFileGetWrite (IFILE *ifilep)
 IFileGetWrite gets the read/write property of an internal file. More...
 
int IFileSetWrite (IFILE *ifilep, int property)
 IFileSetWrite sets the read/write property of an internal file. More...
 
int IFileGetWriteDataset (hid_t dataset_id)
 IFileGetWriteDataset gets the read/write property of an internal file. More...
 
long int IFileSize (IFILE *ifilep)
 IFileSize gets the #bytes in an internal file. More...
 
long int IFileSizeHDF (IFILE *ifilep)
 IFileSizeHDF gets the #bytes in an internal file. More...
 
int IFileTruncate (IFILE *ifilep, long int length)
 IFileTruncate changes the size of an internal file. More...
 
int IFileWrite (IFILE *ifilep, const void *buf, int size, int count)
 IFileWrite writes bytes to an internal file. More...
 
int IFileReadALine (IFILE *ifilep, char *str, int num)
 IFileReadALine reads a string from an internal file. More...
 

Function Documentation

int IFileAllocate ( IFILE ifilep,
long int  offset,
long int  length 
)

IFileAllocate is used to allocate more space to an internal file.

Parameters
[in]ifilepThe struct of the open internal file.
[in]offsetThe offset, in bytes, from the start of the file where the newly-allocates bytes must start. Should be >= 0.
[in]lengthThe length, in bytes, of the region of the newly-allocated bytes. Should be >0.
Returns
TRUE is returned on success, FALSE otherwise. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to add 100 bytes to the end of an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 long int istart, icount;
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(!ifilep) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 istart=IFileSize(ifilep);
11 
12 icount = 100L;
13 if(!IFileAllocate(ifilep, istart, icount)){
14  printf("allocate failed\n");
15 }
Details
If the size of the file is less than offset+len, then the file is increased to this size; otherwise the file size is left unchanged. This function is meant to emulate as close as possible the standard posix_fallocate() function.
int IFileClearError ( IFILE ifilep)

IFileClearError clears the error condition on an internal file.

Parameters
[in]ifilepThe struct of the open internal file.
Returns
TRUE is returned on SUCCESS, FALSE otherwise. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to clear any error related to the previous read from an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 char c;
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 ....
7 c = IFileGets(ifilep);
8 
9 IFileClearError(ifilep);
Details
This function is meant to emulate as close as possible the standard C clearerr() function.
int IFileClose ( IFILE ifilep)

IFileClose closes an internal file in a GeoSci File.

See also
IFileOpen
Parameters
[in]ifilepThe struct of the open internal file.
Returns
TRUE is returned on success, FALSE on failure. The error_string variable is also set to a system-specific error code on failure.
Example 1
Let's assume that one already has an GeoSci file, and one wants to close an internal file name "/somename":
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 if(!IFileClose(ifilep)){
9  printf("IFileClose failed on /somename\n");
10 }
Example 2
Let's assume that one already has an GeoSci file, and one wants to close an internal file that's inside another group:
1 hid_t file_id, group_id;
2 IFILE *ifilep;
3 
4 group_id = GS_GroupCreate(file_id,"/group1");
5 if(group_id < 0) {
6  printf("GS_GroupCreate failed on /group1\n");
7  exit(-1);
8 }
9 ifilep = IFileOpen(file_id,"/group1/somename","w");
10 if(!ifilep) {
11  printf("IFileOpen failed on /group1/somename\n");
12  exit(-1);
13 }
14 if(!IFileClose(ifilep)){
15  printf("IFileClose failed on /group1/somename\n");
16  exit(-1);
17 }
Details
This function is meant to emulate as close as possible the standard C fclose() function.
int IFileEOF ( IFILE ifilep)

IFileEOF returns the End-Of-File condition of the previous internal read.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns
TRUE is returned if a previous read tried to read past the end-of-file, FALSE if not. ERROR is returned on any kind of error. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to determine if the previous read from an internal file named "/somename" succeeded or not.
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 if(!IFileEOF(ifilep)){
9  printf("previous read DID NOT read past end-of-file\n");
10 } else {
11  printf("previous read DID read past end-of-file\n");
12 }
Details
This function is meant to emulate as close as possible the standard C feof() function.
int IFileError ( IFILE ifilep)

IFileError returns error condition on an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns
FALSE is returned if "last_operation_status" metadata for the internal file is "SUCCESS", TRUE otherwise. ERROR is returned on any kind of error. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to determine if the previous read from an internal file named "/somename" succeeded or not.
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 
9 if(!IFileError(ifilep)){
10  printf("previous read DID NOT cause an error\n");
11 } else {
12  printf("previous read DID cause an error\n");
13 }
Details
This function is meant to emulate as close as possible the standard C ferror() function.
int IFileFlush ( IFILE ifilep)

IFileFlush flushes unwritten buffers to an internal file in a GeoSci File.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns
TRUE is returned on success, FALSE on failure. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to flush an internal file named "/somename":
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 if(!IFileFlush(ifilep)){
9  printf("IFileFlush failed on /somename\n");
10 }
Details
This function is meant to emulate as close as possible the standard C fflush() function.
int IFileGetc ( IFILE ifilep)

IFileGetc reads a character from an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns
On success, the character read is returned (promoted to an int value). If the file position indicator was at the end-of-file, the function returns ERROR and sets the end-of-file indicator (IFileEOF). If some other reading error happens, the function also returns ERROR, but sets its error indicator (IFileError) instead.
Example
Let's assume that one already has an GeoSci file, and one wants to read the next character from an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 int the_int_char;
4 char the_char;
5 
6 ifilep = IFileOpen(file_id,"/somename","w");
7 if(!ifilep) {
8  printf("IFileOpen failed on /somename\n");
9 }
10 
11 the_int_char = IFileGetc(ifilep);
12 if(the_int_char < 0) {
13  printf("read failed\n");
14 }
15 
16 the_char = (char *)the_int_char;
17 
18 ...use the_char here....
Details
This function is meant to emulate as close as possible the standard C fgetc() function.
char* IFileGets ( IFILE ifilep,
char *  str,
int  num 
)

IFileGets reads characters from an internal file in a geosci file, and stores them as a string until the maximum number of characters have been read or either a newline or the end-of-file is reached, whichever happens first.

See also
IFileOpen, FileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in,out]strPointer to an array of chars where the string read is copied.
[in]numMaximum number of characters to be copied into str (including the terminating null-character).
Returns

On success, the function returns str.

If the end-of-file is encountered while attempting to read a character, the eof indicator is set (IFileEOF). If this happens before any characters could be read, the pointer returned is a null pointer (and the contents of str remain unchanged).

If a read error occurs, the error indicator (IFileError) is set and a null pointer is also returned (but the contents pointed-to by str may have changed).

Example
Let's assume that one already has an GeoSci file, and one wants to read the next line of characters (up to the next "\n") from an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 char the_string[1000];
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(!ifielp) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 the_string = IFileGets(ifilep, the_string, 1000);
11 if(!the_string) {
12  printf("read failed\n");
13 }
14 
15 ...use the_string here....
Details
This function is meant to emulate as close as possible the standard C fgets() function.
int IFileGetWrite ( IFILE ifilep)

IFileGetWrite gets the read/write property of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns

TRUE is returned if the internal file is writeable, FALSE if not writeable.

ERROR is returned on any kind of error. The error_string variable is also set to a system-specific error code on failure.

Example
Let's assume that one already has an GeoSci file, and one wants to determine if the internal file named "/somename" is writeable.
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 
9 status = IFileGetWrite(ifilep);
10 if( status ==FALSE){
11  printf("Cannot write to internal file\n");
12 } else if(status == TRUE) {
13  printf("Can write to internal file\n");
14 } else {
15  printf("error getting write-status of internal file\n");
16 }
Details
This function is meant to enable a user to make an internal file have read and write rights like in the standard file system.
int IFileGetWriteDataset ( hid_t  dataset_id)

IFileGetWriteDataset gets the read/write property of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]id;The handle of the open dataset.
Returns

TRUE is returned if the dataset is writeable, FALSE if not writeable.

ERROR is returned on any kind of error. The error_string variable is also set to a system-specific error code on failure.

Example
Let's assume that one already has an GeoSci file, and one wants to determine if the internal file named "/somename" is writeable.
1 hid_t file_id;
2 hid_t dataset_id;
3 
4 dataset_id = GS_DatasetOpen(file_id,"/somename");
5 if(datset_id < 0) {
6  printf("GS_DatasetOpen failed on /somename\n");
7 }
8 
9 status = IFileGetWriteDataset(ifilep);
10 if( status ==FALSE){
11  printf("Cannot write to internal file\n");
12 } else if(status == TRUE) {
13  printf("Can write to internal file\n");
14 } else {
15  printf("error getting write-status of internal file\n");
16 }
Detials
This function is meant to enable a user to make an internal file have read and write rights like in the standard file system.
IFILE* IFileOpen ( hid_t  file_id,
const char *  ifilename,
const char *  access 
)

IFileOpen is used to open an internal file in a GeoSci File.

Parameters
[in]file_idThe handle of the open GeoSci file.
[in]ifilenameThe name of the internal file in an existing GeoSci file to be opened. Use Unix filenaming conventions, giving the full pathname, starting with "/". All but the last component of this name must already exist.
[in]accessAccess mode for the IFile, similar to that used for files:
  • "r" read: Open internal file for input operations. Must already exist.
  • "w" write: Create an empty file for output operations. If an internal file with the same name already exists, its contents are discarded and the file is treated as a new empty internal file.
  • "a" append: Open internal file for output at the end of a the file. Output operations always write data at the end of the file, expanding it. Repositioning operations (IFileSeek, IFileSetpos, IFileRewind) are silently ignored. The internal file is created if it does not exist.
  • "r+" read/update: Open an internal file for update (both for input and output). The file must already exist.
  • "w+" write/update: Create an empty internal file and open it for update (both for input and output). If an internal file with the same name already exists its contents are discarded and the internal file is treated as a new empty file.
  • "a+" append/update: Open an internal file for update (both for input and output) with all output operations writing data at the end of the file. Repositioning operations (IFileSeek, IFileSetpos, IFileRewind) affect the next input operations, but output operations move the position back to the end of internal file. The internal file is created if it does not exist.

The letter "x" can be appended to any "w" specifier (to form "wx" or "w+x"). This subspecifier forces the function to fail if the internal file exists, instead of overwriting it.
Sometimes a "b" is appended to indicate binary mode for reading and writing, but that is not necessary, so it is ignored.

Returns
If the internal file is successfully opened, the function returns a pointer to a structure, otherwise a NULL pointer is returned.
Example 1
Let's assume that one already has an GeoSci file, and one wants to add an internal file, named "somename", off of the root:
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
Example 2
Let's assume that one already has an GeoSci file, and one wants to add an internal file inside another group:
1 hid_t file_id, group_id;
2 IFILE *ifilep;
3 bstring name=bfromcstr("/group1");
4 group_id = GS_GroupCreate(file_id,name);
5 bdestroy(name);
6 if(group_id < 0) {
7  printf("GroupCreate failed on /group1\n");
8  exit(-1);
9 }
10 ifilep = IFileOpen(file_id,"/group1/somename","w");
11 if(!ifilep) {
12  printf("IFileOpen failed on /group1/somename\n");
13  exit(-1);
14 }
Details

This function is meant to emulate as close as possible the standard C fopen() function.

For internal files open for update (those which include a "+" sign), on which both input and output operations are allowed, the file should be flushed (IFileFlush) or repositioned (IFileSeek, IFileSetpos, IFileRewind) between either a writing operation followed by a reading operation or a reading operation which did not reach the end-of-file followed by a writing operation.

When appropriate, this routine creates a single-dimensional unsigned-8-bit dataset with the given name. The components of the pathname above the filename must already exist, and be HDF5 groups in order for this to work.

Note that even if you intend to only read from an IFile, you need to open the GeoSci file for reading AND writing ("r+"). This is because the state of the internal file is written to metadata in the GeoSci file, even if one is only reading from the IFile.

Implementation

For developers, the details of the implementation are presented here.

The complete list of all 34 IFile-related functions is given below:

  • GS_ObjectIsIFile (also contains ObjectIsIFileByID)
  • GS_ObjectIsMetadataIFile
  • DatasetGetType
  • DatasetSetType
  • IFileAllocate
  • IFileClearError
  • IFileClose
  • IFileEOF
  • IFileError
  • IFileFlush
  • IFileGetc
  • IFileGets
  • IFileGetWrite
  • IFileOpen
  • IFilePerror
  • IFilePrintf
  • IFilePutc
  • IFilePuts
  • IFileReadAccess
  • IFileRead
  • IFileReadStatus
  • IFileRewind
  • IFileScanf
  • IFileSeek
  • IFileSetEOF
  • IFileSetWriteability
  • IFileSetWrite
  • IFileSize
  • IFileTell
  • IFileTruncate
  • IFileWriteAccess
  • IFileWrite
  • IFileWriteStatus
  • IFileWriteStatusMessage

Some of these are named based on the standard C library functions that they emulate. Others are implementation-specific functions.

The overall idea of a IFile is that of a HDF5 dataset. This dataset is 1-dimensional, with a datatype of unsigned-8-bit. It is infinitely extendable. It has three string attributes:

  • writeable: "TRUE" or "FALSE". The user can set this so that don't accidentally over-write it or delete it. All IFiles are created with writeable="TRUE"
  • access: an integer betwen 0 and 6, converted to a string. Corresponds to one of the following #define'd parameters:
    • IFILE_CLOSED 0
    • IFILE_R 1
    • IFILE_W 2
    • IFILE_A 3
    • IFILE_RP 4
    • IFILE_WP 5
    • IFILE_AP 6
    These are named based on the access string used during the IFileOpen() function-call, the "P" meaning "+". This keeps track of how the file was opened so only appropriate operations are allowed. Note that a file that is open cannot be opened by another command: the file must be CLOSED in order to be opened. This implements a very simple locking mechanism
  • dataset_type: for an IFile this must be "10", which corresponds to the C #define GS_OBJECT_TYPE_IFILE This is needed because image rasters are stored as datasets as well, and we need to distinguish between these.

The returned data structure is defined as:

1 typedef struct {
2  hid_t ifile_id;
3  long int file_position;
4  int readPastEOF;
5  int last_operation_status;
6  bstring last_operation_status_message;
7  int access;
8  long int size;
9 } IFILE;

The parameters in this structure are defined as follows:
  • ifile_id: the HDF5 object-id for this dataset.
  • file_position: This is the next byte to read-from or write-to, where file_position=0 means to read/write the first byte in the file.
  • readPastEOF: "TRUE"=1 or "FALSE"=0. Whether the previous operation tried to read past the last byte in the file.
  • last_operation_status: "SUCCESS"=1 or "FAILURE"=0 Each operation on the IFile sets this.
  • last_operation_status_message: a string written by each of the IFile functions, whether they succeed or fail.
  • access: A copy of the dataset-metadata entry.
  • size: The current file size in bytes. This is obtained when opened using HDF5 function calls. Thereafter it is updated by the the functions as needed.
Functions that deal with these metadata items are given below. Generally the user should never call any of these, except for:
  • GS_ObjectIsIFile – must be a dataset with dataset_type="1"
  • GS_DatasetGetType– returns the dataset_type
  • GS_DatasetSetType– sets the dataset_type
  • IFileClearError – sets last_operation_status="SUCCESS" and sets last_operation_status_message
  • IFileError – returns TRUE if last_operation_status="FAILURE"
  • IFilePerror – prints last_operation_status_message
  • IFileReadStatus – reads last_operation_status, and last_operation_status_message
  • IFileWriteStatus – writes last_operation_status, and last_operation_status_message
  • IFileWriteStatusMessage – writes last_operation_status_message
  • IFileEOF – returns TRUE if readPastEOF="TRUE"
  • IFileSetEOF – writes to readPastEOF
  • IFileGetWrite – returns TRUE If writeable="TRUE"
  • IFileSetWrite – sets writeability (developer function)
  • IFileSetWriteability – sets writeability (user function)
  • IFileReadAccess – reads access
  • IFileWriteAccess – writes access
  • IFileSeek – sets file_position
  • IFileTell – reads file_position
  • IFileRewind – sets file_position to "0"
Functions to deal with the file size directly:
  • IFileTruncate – sets size of file (can shrink or grow)
  • IFileAllocate – expands file size if needed
  • IFileSize – gets the current file size from the struct
  • IFileSizeHDF – gets the current file size from HDF
Other functions that the user can use include:
  • IFileOpen – open an IFile
  • IFileClose – close an IFile
  • IFileFlush – flush any changes to the IFile to disk
  • IFileGetc – read a single character
  • IFileGets – read a newline-terminated string
  • IFileRead – read a set number of bytes
  • IFileScanf – formatted-read from next "line"
  • IFilePutc – write a single character
  • IFilePuts – write a newline-terminated string
  • IFileWrite – write a set number of bytes
  • IFilePrintf – write a formatted string
Note that there is only ONE COPY of the file state, so there can only be one process that is using it at one time. This is on purpose so that there are no parallel-read-write issues.
int IFilePerror ( IFILE ifilep,
const char *  str 
)

IFilePerror prints latest error for an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]strString containing a custom message to be printed before the error message itself. If it is a null pointer, no preceding custom message is printed, but the error message is still printed. By convention, the name of the application itself is generally used as parameter.
Returns

TRUE is returned on success, FALSE otherwise.

This function should be called right after the error was produced, otherwise the error of interest can be overwritten by calls to other functions.

Example
Let's assume that one already has an GeoSci file, and one wants to print the latest error related to an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 
9 if(!IFilePerror(ifilep,NULL)){
10  printf("perror failed\n");
11 }
Details
Prints the latest error message related to the internal file to stdout, optionally preceded by the custom message provided in str. This function is meant to emulate as close as possible the standard C perror() function.
int IFilePrintf ( IFILE ifilep,
const char *  format,
  ... 
)

IFilePrintf writes formatted data to an internal file.

See also
IFileOpen(), IFileClose()
Parameters
[in]ifilepThe struct of the open internal file.
[in]formatString that contains the text to be written to the internal file. It can optionally contain embedded format specifiers that are replaced by the values specified in subsequent additional arguments and formatted as requested. See docs for fscanf() in any C book for the complete details.
[in]...(additional arguments) Depending on the format string, the function may expect a sequence of additional arguments, each containing a pointer to allocated storage where the interpretation of the extracted characters is stored with the appropriate type. There should be at least as many of these arguments as the number of values stored by the format specifiers. Additional arguments are ignored by the function.
Returns

On success, the function returns the number of characters successfully written.

If a reading error happens or the end-of-file is reached while reading, the proper indicator is set (IFileEOF() or IFileError()). And, if either happens before any data could be successfully written, ERROR is returned.

The error_string variable is also set to a system-specific error code on failure.

Example
Let's assume that one already has an GeoSci file, and one wants to write a string to the next line of the internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 int an_int;
4 int n;
5 
6 ifilep = IFileOpen(file_id,"/somename","w");
7 if(!ifilep) {
8  printf("IFileOpen failed on /somename\n");
9 }
10 an_int = 5;
11 n =IFilePrintf(ifilep, "The value is: %d", an_int);
12 if(n==1){
13  printf("successfully wrote the integer: %d\n",an_int);
14 } else {
15  printf("problem writing the integer\n");
16 }
Details

This function is meant to emulate as close as possible the standard C fprintf() function.

Writes the string pointed by format to the internal file. If format includes format specifiers (subsequences beginning with %), the additional arguments following format are formatted and inserted in the resulting string replacing their respective specifiers.

After the format parameter, the function expects at least as many additional arguments as specified by format.

int IFilePutc ( IFILE ifilep,
char  character 
)

IFilePutc writes a single character to an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]characterThe character to write.
Returns

On success, TRUE is returned.

If some writing error happens, the function returns FALSE, and sets its error indicator (IFileError).

Exmaple
Let's assume that one already has an GeoSci file, and one wants to write the character 'a' to an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 int the_int_char;
4 char the_char;
5 
6 ifilep = IFileOpen(file_id,"/somename","w");
7 if(!ifilep) {
8  printf("IFileOpen failed on /somename\n");
9 }
10 
11 the_char = 'a';
12 if(!IFilePutc(ifilep, the_char)){
13  printf("write failed\n");
14 }
Details
This function is meant to emulate as close as possible the standard C fputc() function.
int IFilePuts ( IFILE ifilep,
const char *  string 
)

IFilePuts writes a string to an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]stringThe character string to write.
Returns
On success, TRUE is returned. If some writing error happens, the function returns FALSE, and sets its error indicator (IFileError).
Example
Let's assume that one already has an GeoSci file, and one wants to write the character string "already" to an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 
9 if(!IFilePuts(ifilep, "already")){
10  printf("write failed\n");
11 }
Details
This function is meant to emulate as close as possible the standard C fputs() function.
size_t IFileRead ( IFILE ifilep,
void *  buf,
int  size,
int  count 
)

IFileRead reads the requested number of bytes from an internal file in a geosci file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in,out]bufPointer to an array where the bytes read are copied to. This must have at least size*count bytes of storage. Using a void pointer here allows the user to pass a buf variable of any type.
[in]sizeSize in bytes of each element to be read.
[in]countNumber of elements to read. Each element has a size of "size" bytes.
Returns

The total number of elements successfully read is returned.

If this number differs from the count parameter, either a reading error occurred or the end-of-file was reached while reading. In both cases, the proper indicator is set, which can be checked with IFileError and IFileEOF, respectively.

If either size or count is less than or equal to zero, the function returns zero and both the internal-file state and the content pointed to by buf remain unchanged.

Example
Let's assume that one already has an GeoSci file, and one wants to read the next 10 characters from an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 char *buf;
4 
5 buf = (char *)GMalloc(10*sizeof(char));
6 if(!buf){
7  printf("GMalloc error\n");
8  exit(-1);
9 }
10 
11 ifilep = IFileOpen(file_id,"/somename","w");
12 if(!ifilep) {
13  printf("IFileOpen failed on /somename\n");
14 }
15 
16 if(IFileRead(ifilep, buf, sizeof(char),10) != 10){
17  printf("read failed\n");
18 }
19 
20 ...use buf here....
Details

This function is meant to emulate as close as possible the standard C fread() function.

The types of size and count are purposely int and not size_t because if the user accidentally passes a negative value the value becomes a very big number when casted to an unsigned integer, which is what size_t is. In order to detect this error, int is used instead.

int IFileReadAccess ( IFILE ifilep)

IFileReadAccess reads access code of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns
On success, one of:
IFILE_CLOSED 0
IFILE_R 1
IFILE_W 2
IFILE_A 3
IFILE_RP 4
IFILE_WP 5
IFILE_AP 6
On failure, ERROR is returned.
Example
Let's assume that one already has an GeoSci file, and one wants to determine the access code for an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 int access_code;
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(!ifilep) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 access_code = IFileReadAccess(ifilep);
11 if(access_code<0){
12  printf("could not obtain access code for internal file\n");
13 }
Details
This function is used by the IFile* functions to determine how to implement each function for a specific file access code.
int IFileReadAccessHDF ( hid_t  dataset_id)

IFileReadAccessHDF reads access code of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]datset_idThe hdf-id of the open internal file dataset-object.
Returns
On success, one of:
IFILE_CLOSED 0
IFILE_R 1
IFILE_W 2
IFILE_A 3
IFILE_RP 4
IFILE_WP 5
IFILE_AP 6
On failure, ERROR is returned.
Example
Let's assume that one already has an GeoSci file, and one wants to determine the access code for an internal file named "/somename".
1 hid_t file_id;
2 his_t dataset_id;
3 int access_code;
4 
5 dataset_id = GS_DatasetOpen(file_id,"/somename");
6 if(dataset_id < 0) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 access_code = IFileReadAccessHDF(dataset_id);
11 if(access_code<0){
12  printf("could not obtain access code for internal file\n");
13 }
Details
This function is used by the IFile* functions to determine how to implement each function for a specific file access code.
int IFileReadALine ( IFILE ifilep,
char *  str,
int  num 
)

IFileReadALine reads a string from an internal file.

IFileReadALine() reads characters from an internal file in a geosci file, and stores them as a string until the maximum number of characters have been read or either a newline or the end-of-file is reached, whichever happens first.

See also
IFileOpen, FileClose, IFileGets
Parameters
[in]ifilepThe struct of the open internal file.
[in,out]strPointer to an array of chars where the string read is copied.
[in]numMaximum number of characters to be copied into str (including the terminating null-character).
Returns

This function uses IFileGets() to read the data, any errors encountered will cause this routine to return ERROR.

If the read succeeds, but the last character read is NOT a newline, then it returns FALSE.

If there are no read errors, and a complete line is read, then TRUE is returned.

Example
Let's assume that one already has an GeoSci file, and one wants to read the next line of characters (up to the next "\n") from an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 char the_string[1000];
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(!ifielp) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 status = IFileReadALine(ifilep, the_string, 1000);
11 if(status==ERROR){
12  printf("read failed\n");
13 } else if (status=FALSE){
14  printf("string is incomplete\n");
15 } else {
16  printf('complete string read successfully.\n");
17 
18  ...use the_string here....
19 }
Details
Similar to IFileGets(), but provides clearer return error codes.
int IFileReadStatus ( IFILE ifilep,
char **  message 
)

IFileReadStatus reads the status properties of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]messageReturned Message associated with the status. No need to GFree it when done.
Returns
On success, the return value is one of:
IFILE_SUCCESS – the last IFile operation succeeded
IFILE_FAILURE – the last IFile operation failed
On failure, FALSE is returned. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one has created an internal file is named "/somename" and the last write operation may have failed. Let's get the status.
1 hid_t file_id;
2 IFILE *ifilep;
3 int status;
4 char *status_str;
5 
6 ifilep = IFileOpen(file_id,"/somename","w");
7 if(!ifilep) {
8  printf("IFileOpen failed on /somename\n");
9 }
10 
11 status = IFileReadStatus(ifilep,&status_str);
12 if(!status){
13  printf("IFileReadStatus failed\n");
14 } else {
15  if(status == IFILE_SUCCESS){
16  printf("status of last operation is: SUCCESS\n");
17  } else {
18  printf("status of last operation is: FAILURE\n");
19  } // endif
20  printf("status message: %s\n",status_str);
21 } // endif
Details
This function encapsulates reading the IFile status metadata.
int IFileRewind ( IFILE ifilep)

IFileRewind moves to the start of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns
TRUE is returned on success, FALSE otherwise. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to rewind an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 
9 if(!IFileRewind(ifilep)){
10  printf("rewind failed\n");
11 }
Details
This function is meant to emulate as close as possible the standard C rewind() function.
int IFileScanf ( IFILE ifilep,
const char *  format,
  ... 
)

IFileScanf reads formatted data from an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]formatString that contains a sequence of characters that control how characters extracted from the stream are treated. See docs for fscanf() in any C book for the complete details.
[in]...(additional arguments) Depending on the format string, the function may expect a sequence of additional arguments, each containing a pointer to allocated storage where the interpretation of the extracted characters is stored with the appropriate type. There should be at least as many of these arguments as the number of values stored by the format specifiers. Additional arguments are ignored by the function. These arguments are expected to be pointers: to store the result of a IFileScanf operation on a regular variable, its name should be preceded by the reference operator (&) (see example).
Returns

On success, the function returns the number of items of the argument list successfully filled. This count can match the expected number of items or be less (even zero) due to a matching failure, a reading error, or the reaching of the end-of-file.

If a reading error happens or the end-of-file is reached while reading, the proper indicator is set (IFileEOF() or IFileError()). And, if either happens before any data could be successfully read, ERROR is returned.

The error_string variable is also set to a system-specific error code on failure.

Example
Let's assume that one already has an GeoSci file, and one wants to read an integer from the next line of the internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 int an_int;
4 int n;
5 
6 ifilep = IFileOpen(file_id,"/somename","w");
7 if(!ifilep) {
8  printf("IFileOpen failed on /somename\n");
9 }
10 n =IFileScanf(ifilep, "%d", &an_int);
11 if(n==1){
12  printf("successfully read the integer: %d\n",an_int);
13 } else {
14  printf("problem reading the integer\n");
15 }
Details
This function is meant to emulate as close as possible the standard C fscanf() function.
int IFileSeek ( IFILE ifilep,
long int  offset,
int  origin 
)

IFileSeek moves to a position in an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]offsetOffset, in bytes, from a reference position where the new file pointer is desired to go. [in] origin Position used as reference for the offset. Specify one of the following constants :
Constant Reference Position
SEEK_SET Start of file
SEEK_CUR Current position in the file
SEEK_END End of file
Returns

TRUE is returned on success, FALSE otherwise.

For situations where the new position would be before the first byte, the file pointer position is not changed, and FALSE is returned.

For situations where the new position is beyond the last byte, this is allowed, but a subsequent read will fail. A subsequent write will "fill in" NULL bytes to get to this point before writing.

The error_string variable is also set to a system-specific error code on failure.

Example
Let's assume that one already has an GeoSci file, and one wants to skip to byte 35 in an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 
9 if(!IFileSeek(ifilep, 35L, SEEK_SET)){
10  printf("seek failed\n");
11 }
Details
This function is meant to emulate as close as possible the standard C fseek() function.
int IFileSetEOF ( IFILE ifilep,
int  value 
)

IFileSetEOF sets End-Of-File condition on an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]filepThe struct of the open internal file.
[in]valueThe value to set the EOF condition to, one of:
TRUE (if there was an EOF ), or:
FALSE (there was not an EOF )
Returns
TRUE is returned when the condition is set successfully, FALSE if not. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to set that the previous read hit an EOF on an internal file named "/somename" succeeded or not.
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep < 0) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 if(!IFileSetEOF(ifilep, TRUE)){
9  printf("could not set EOF condition\n");
10 } else {
11  printf("successfully set EOF condition to TRUE\n");
12 }
Details
This function is used internally by the IFile* functions, and is not meant for usage by the normal user.
int IFileSetWrite ( IFILE ifilep,
int  property 
)

IFileSetWrite sets the read/write property of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]propertyThe value to set the read/write property to:
GS_READ – internal file set to read-only mode
GS_WRITE – internal file set to read and write mode
Returns
TRUE is returned on success, FALSE otherwise. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to create an internal file is named "/somename" and make it writeable. This is used by the internal IFileOpen routine when creating a new internal file.
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 
9 if(!IFileSetWrite(ifilep,GS_WRITE)){
10  printf("IFileSetWrite to read-write failed\n");
11 }
Details
This function is meant to enable IFileOpen to make an internal file have read and write rights on creation.
int IFileSetWriteability ( hid_t  file_id,
const char *  name,
int  property 
)

IFileSetWriteability sets the read/write property of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]file_idThe handle of the open geosci file.
[in]nameName of the internal file whose properties need to be altered. The internal file must not be open, otherwise this operation will fail.
[in]propertyThe value to set the read/write property to:
GS_READ – internal file set to read-only mode
GS_WRITE – internal file set to read and write mode
Returns
TRUE is returned on success, FALSE otherwise. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to make sure the file is not writeable accidentally. The internal file is named "/somename".
1 hid_t file_id;
2 
3 if(!IFileSetWriteability(file_id,"/somename",GS_READ)){
4  printf("IFileSetWriteability to read-only failed\n");
5 }
Details
This function is meant to enable a user to make an internal file have read and write rights like in the standard file system.
long int IFileSize ( IFILE ifilep)

IFileSize gets the #bytes in an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns
On success, the number of characters in the internal file is returned. -1 is returned on error.
Example
Let's assume that one already has an GeoSci file, and one wants to know the size of an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 long int numbytes;
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(!ifilep) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 numbytes = IFileSize(ifilep);
11 if(numbytes < 0) {
12  printf("failed to get file size\n");
13 }
Details
There is no equivalent standard C function to get the size of an open file.
long int IFileSizeHDF ( IFILE ifilep)

IFileSizeHDF gets the #bytes in an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns
On success, the number of characters in the internal file is returned. -1 is returned on error.
Example
Let's assume that one already has an GeoSci file, and one wants to know the size of an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 long int numbytes;
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(ifilep < 0) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 numbytes = IFileSizeHDF(ifilep);
11 if(numbytes < 0) {
12  printf("failed to get file size\n");
13 }
Details
There is no equivalent C function to get the size of an open file. This is distinct from IFileSize() because this function asks the HDF5 system how big the dataset is. This is useful when we need to initialize the size when we open an existing IFILE.
long int IFileTell ( IFILE ifilep)

IFileTell retrieves the current read/write position in an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
Returns
The position in the file is returned on success, and -1L on failure. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to find the position of the file-pointer in an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 long int position;
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(!ifilep) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 position = IFileTell(ifilep);
11 if(position < 0){
12  printf("tell failed\n");
13 }
Details
This function is meant to emulate as close as possible the standard C ftell() function.
int IFileTruncate ( IFILE ifilep,
long int  length 
)

IFileTruncate changes the size of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]lengthThe desired length, in bytes, of the file. Must be >= 0.
Returns
TRUE is returned on success, FALSE otherwise. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to make the new size be 1000 bytes for an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 long int icount;
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(!ifilep) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 icount = 1000L;
11 if(!IFileTruncate(ifilep, icount)){
12  printf("truncate failed\n");
13 }
Details
If the size of the file is less than length, then the file is increased to this size. If the size of the file is greater than length, then the file is decreased to this size. This function is meant to emulate as close as possible the standard C ftruncate() function.
int IFileWrite ( IFILE ifilep,
const void *  buf,
int  size,
int  count 
)

IFileWrite writes bytes to an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in,out]bufPointer to an array where the bytes to write are read from. This must have at least size*count bytes of storage. Using a void pointer here allows the user to pass a buf variable of any type.
[in]sizeSize in bytes of each element to be written.
[in]countNumber of elements to write. Each element has a size of "size" bytes.
Returns

The total number of elements successfully written is returned.

If this number differs from the count parameter, a writing error prevented the function from completing. In this case, the error indicator (IFileError) will be set for the stream.

If either size or count is less than or equal to zero, the function returns zero and both the internal-file state and the content pointed to by buf remain unchanged.

Example
Let's assume that one already has an GeoSci file, and one wants to write 10 ints in an int vector (starting at index 5) to an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 int intvec[100];
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(!ifilep < 0) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 if(!IFileWrite(ifilep,intvec+5, sizeof(int),10L )){
11  printf("write failed\n");
12 }
Details
This function is meant to emulate as close as possible the standard C fwrite() function.
int IFileWriteAccess ( IFILE ifilep,
int  code 
)

IFileWriteAccess writes a new access code for an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]codeThe access code one wishes to write to the file, one of:
IFILE_CLOSED 0
IFILE_R 1
IFILE_W 2
IFILE_A 3
IFILE_RP 4
IFILE_WP 5
IFILE_AP 6
Returns
TRUE is returned on success, FALSE on failure.
Example
Let's assume that one already has an GeoSci file, and one wants to set the access code to read-only for an internal file named "/somename".
1 hid_t file_id;
2 IFILE *ifilep;
3 int access_code;
4 
5 ifilep = IFileOpen(file_id,"/somename","w");
6 if(!ifilep) {
7  printf("IFileOpen failed on /somename\n");
8 }
9 
10 if(!IFileWriteAccess(ifilep, IFILE_R)){
11  printf("could not set access code for internal file\n");
12 }
Details
This function is used by the IFile* functions to set the internal-file access policy. They can be read, write, append, read-and-update, write-and-update, append-and-update, as well as closed. This routine is for use by the IFile* routines, and not normally for use by ordinary users.
int IFileWriteStatus ( IFILE ifilep,
int  status,
const char *  message 
)

IFileWriteStatus writes the status properties of an internal file.

See also
IFileOpen, IFileClose
Parameters
[in]ifilepThe struct of the open internal file.
[in]statusThe value to set the status property to:
IFILE_SUCCESS – the last IFile operation succeeded
IFILE_FAILURE – the last IFile operation failed
[in]messageMessage associated with the status.
Returns
TRUE is returned on success, FALSE otherwise. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one has created an internal file is named "/somename" and the last write operation failed (using IFilePutc()).
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 
6 if(!IFileWriteStatus(ifilep,IFILE_FAILURE,"IFilePutc() failed")){
7  printf("IFileWriteStatus failed\n");
8 }
Details.
This function encapsulates writing the IFile status metadata. This function would not be used by the ordinary user.
int IFileWriteStatusMessage ( IFILE ifilep,
const char *  message 
)

IFileWriteStatusMessage writes the status message of an internal file.

See also
IFileOpen, FileClose, IFileWriteStatus
Parameters
[in]ifilepThe struct of the open internal file.
[in]messageMessage associated with the status.
Returns
TRUE is returned on success, FALSE otherwise. The error_string variable is also set to a system-specific error code on failure.
Example
Let's assume that one already has an GeoSci file, and one has created an internal file is named "/somename" and one wishes to write a status message that the last operation caused the file to hit the end-of-file.
1 hid_t file_id;
2 IFILE *ifilep;
3 
4 ifilep = IFileOpen(file_id,"/somename","w");
5 if(!ifilep) {
6  printf("IFileOpen failed on /somename\n");
7 }
8 
9 if(!IFileWriteStatusMessage(ifilep,"IFilePutc() hit EOF")){
10  printf("IFileWriteStatusMessage failed\n");
11 }
Details
This function encapsulates writing the IFile status metadata. This function would not normally be called by a user.