float swapEnds(float littleE) { float bigE; unsigned char *a, *b; a = (unsigned char *) &littleE; b = (unsigned char *) &bigE; b[0] = a[3]; b[1] = a[2]; b[2] = a[1]; b[3] = a[0]; return bigE; } main() { float r, s; ... r = 0; for (i = 0; i < NDATA; i++) { s = swapEnds(r); fwrite( &s, 1, 4, grib ); r += (float)0.001; } ... }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)