Read C-binary files. More...
#include <stdio.h>
#include "cfortran.h"
Go to the source code of this file.
Functions/Subroutines | |
void | initC (int *nFiles) |
Initialises the 'global' variables used for file handling. | |
void | resetC (int *nFileIn) |
Rewind file. | |
void | openC (const char *fileName, int *errorFlag) |
Open file. | |
void | readC (float *bufferFloat, int *bufferInt, int *lengthBuffers, int *nFileIn, int *errorFlag) |
Read record from file. |
Variables | |
FILE ** | files |
pointer to list of pointers to opened binary files | |
unsigned int | maxNumFiles |
max number of files | |
unsigned int | numAllFiles |
number of opened files |
Read C-binary files.
C-methods to handle input of C/C++ binary files as input for the fortran pede program (see peread). This includes macros utilising cfortran.h
to allow direct callability from fortran.
initC()
has to be called once in the beginning, followed by one or several calls to openC()
to open one or several files. readC()
is then called to read the records sequentially. resetC()
allows to rewind files.
If compiled with preprocessor macro USE_SHIFT_RFIO
, uses libRFIO
, i.e. includes shift.h
instead of stdio.h
If compiled with preprocessor macro USE_ZLIB
, uses libz
, enables direct reading of gzipped files.
Written by Gero Flucke (gero.) in 2006/7 fluc ke@ce rn.c h
readC()
Last major update on April 24th, 2012 by C.Kleinwort:
Definition in file readc.c.
void initC | ( | int * | nFiles | ) |
Initialises the 'global' variables used for file handling.
[in] | nFiles | Maximal number of C binary files to use. |
Definition at line 61 of file readc.c.
References files, maxNumFiles, and numAllFiles.
void openC | ( | const char * | fileName, |
int * | errorFlag | ||
) |
Open file.
[in] | fileName | File name |
[out] | errorFlag | error flag:
|
Definition at line 113 of file readc.c.
References files, maxNumFiles, and numAllFiles.
void readC | ( | float * | bufferFloat, |
int * | bufferInt, | ||
int * | lengthBuffers, | ||
int * | nFileIn, | ||
int * | errorFlag | ||
) |
Read record from file.
[out] | bufferFloat | read buffer for floats |
[out] | bufferInt | read buffer for integers |
[in,out] | lengthBuffers | in: buffer length, out: number of floats/ints in records (> buffer size: record skipped) |
[in] | nFileIn | File number (1 .. maxNumFiles) |
[out] | errorFlag | error flag:
|
Definition at line 170 of file readc.c.
References files.
void resetC | ( | int * | nFileIn | ) |
FILE** files |
unsigned int maxNumFiles |