146 FILE *f = fopen(pFileName,
"rb");
153 if (fread(header, 29, 1, f) != 1)
159 if (strstr(header,
"MATRIX") != header)
165 const int nColumns = atoi(header + 7);
166 const int nRows = atoi(header + 18);
168 if (nColumns <= 0 || nRows <= 0)
191 #ifdef IVT_BIG_ENDIAN 193 for (
int i = 0; i < nWords; i++)
205 FILE *f = fopen(pFileName,
"wb");
209 #ifdef IVT_BIG_ENDIAN 212 for (i = 0; i < nWords; i++)
216 fprintf(f,
"MATRIX %.10i %.10i ",
columns, rows);
217 if (fwrite(
data,
columns * rows *
sizeof(
float), 1, f) != 1)
224 #ifdef IVT_BIG_ENDIAN 225 for (i = 0; i < nWords; i++)
float invert_byte_order_float(float x)
bool SaveToFile(const char *pFileName)
bool LoadFromFile(const char *pFileName)
Data structure for the representation of a matrix of values of the data type float.
GLsizei GLsizei GLenum GLenum const GLvoid * data