51 #define LINE_SIZE 65536
114 FILE *
xfopen(
const char * fname,
const char * mode );
115 FILE *
xfopen(
const std::string &fname,
const char * mode );
118 FILE *
xfreopen(
const char * filename,
const char * mode, FILE * stream );
123 int xfprintf( FILE * out,
const char * fmt, ... );
124 int xfscanf( FILE * in,
const char * fmt, ... );
129 char *
xfgets(
char *s,
int n, FILE *in );
131 int xgetc( FILE * f );
132 int xungetc(
int c, FILE * f );
138 size_t xfread(
void * ptr,
size_t size,
size_t count, FILE * stream );
139 size_t xfwrite(
const void * ptr,
size_t size,
size_t count, FILE * stream );
149 int xfeof ( FILE * f );
int verbosity_
internal XIO debug: print info at each XIO function
void set_verbosity(int verb)
Enable/Disable XIO debug output for EACH XIO function call.
int xfflush(FILE *f)
Flush file stream.
void xrewind(FILE *f)
Rewind file, handle line count.
static Xio * get_instance()
return instance
struct xfile XFILE
XFILE structure holds additional info to generic FILE.
int xfclose(FILE *stream)
FCLOSE WITH ERROR HANDLING.
size_t xfwrite(const void *ptr, size_t size, size_t count, FILE *stream)
Write block of data to stream, handle errors.
char * xio_getfname(FILE *f)
Get file name from pointer to FILE structure.
int xgetc(FILE *f)
getc() with error handling and line count
int xfprintf(FILE *out, const char *fmt,...)
FPRINTF WITH ERROR HANDLING.
char * xfgets(char *s, int n, FILE *in)
FGETS WITH ERROR HANDLING and line count.
size_t xfread(void *ptr, size_t size, size_t count, FILE *stream)
Read block of data from stream, handle errors.
int xio_getlinesread(FILE *f)
Get number of lines that were completely read from file since fopen() or rewind() ...
XFILEMAP & get_xfile_map()
Get XIO mapping instance.
FILE * xfreopen(const char *filename, const char *mode, FILE *stream)
Reopen stream with different file or mode.
Global macros to enhance readability and debugging, general constants.
char * xio_getfmode(FILE *f)
Get file mode from file stream.
XFILE structure holds additional info to generic FILE.
char * xio_getfulldescription(FILE *f)
Get pointer to string with full file description.
int lineno
last read line (only for text files)
int xfgetc(FILE *f)
fgetc() with error handling and line count
map< FILE *, XFILE * > XFILEMAP
mapping of ptr to regular file structure to extended structure
char * filename
file name in the time of opening
int xfeof(FILE *f)
Check END OF FILE.
int get_verbosity()
Get current XIO debug verbosity level.
int xungetc(int c, FILE *f)
ungetc() with error handling and line count
int xfscanf(FILE *in, const char *fmt,...)
FSCANF WITH ERROR HANDLING.
static void init()
initialize XIO library
XFILEMAP xfiles_map_
mapping instance
FILE * xfopen(const std::string &fname, const char *mode)