13 #ifndef FI_SWAPPED_IO_H
14 #define FI_SWAPPED_IO_H
25 int nChar =
sizeof(T);
26 size_t nBytes =
FT_read(p,nChar,1,fd);
27 for (
int i = nChar-1; i > 0; i--, q++)
38 int nChar =
sizeof(T);
39 char* p = (
char*)&val;
40 char* q = (
char*)(&swappedValue);
41 for (
int i = nChar-1; i > 0; i--, q++)
45 return FT_write(&swappedValue,nChar,1,fd);
Functions and data type for direct access of large binary files.
#define FT_FILE
File pointer.
Definition: FFaIO.H:136
#define FT_read(buf, n, m, f)
Reads an array from file.
Definition: FFaIO.H:118
#define FT_write(buf, n, m, f)
Writes an array to file.
Definition: FFaIO.H:120
File handling utilities.
Definition: FiSwappedIO.H:20
size_t writeSwapped(const T val, FT_FILE fd)
Writes the data word val with byte swapping.
Definition: FiSwappedIO.H:35
size_t readSwapped(char *q, T &, FT_FILE fd)
Reads a data word of type T with byte swapping.
Definition: FiSwappedIO.H:22