7 /* wesley ebisuzaki v1.3
9 * write ieee file -- big endian format
11 * input float *array data to be written
13 * int header 1 for f77 style header 0 for none
14 * (header is 4 byte header
15 * FILE *output output file
17 * v1.2 7/97 buffered, faster
18 * v1.3 2/99 fixed (typo) error in wrtieee_header found by
24 int wrtieee(float *array
, int n
, int header
, FILE *output
) {
28 unsigned char buff
[BSIZ
];
34 for (i
= 0; i
< 4; i
++) {
43 for (i
= 0; i
< n
; i
++) {
45 fwrite(buff
, 1, BSIZ
, output
);
48 flt2ieee(array
[i
], buff
+ nbuf
);
53 fwrite(buff
, 1, BSIZ
, output
);
61 if (nbuf
) fwrite(buff
, 1, nbuf
, output
);
65 /* write a big-endian 4 byte integer .. f77 IEEE header */
67 int wrtieee_header(unsigned int n
, FILE *output
) {
71 h4
[1] = (n
>> 8) & 255;
72 h4
[2] = (n
>> 16) & 255;
73 h4
[3] = (n
>> 24) & 255;