7 |
|
* 5/18/88 |
8 |
|
*/ |
9 |
|
|
10 |
– |
#include <stdio.h> |
10 |
|
#include <stdlib.h> |
11 |
|
#include <ctype.h> |
12 |
|
#include <math.h> |
13 |
|
#include "platform.h" |
14 |
+ |
#include "rtio.h" |
15 |
|
|
16 |
|
#define MAXCOL 8192 /* maximum number of columns */ |
17 |
|
|
170 |
|
int nf; |
171 |
|
/* reading binary input? */ |
172 |
|
if (nbicols > 0) |
173 |
< |
return(fread(field, sizeof(double), nbicols, fp)); |
173 |
> |
return(getbinary(field, sizeof(double), nbicols, fp)); |
174 |
|
if (nbicols < 0) { |
175 |
|
float *fbuf = (float *)buf; |
176 |
|
int i; |
177 |
< |
nf = fread(fbuf, sizeof(float), -nbicols, fp); |
177 |
> |
nf = getbinary(fbuf, sizeof(float), -nbicols, fp); |
178 |
|
for (i = nf; i-- > 0; ) |
179 |
|
field[i] = fbuf[i]; |
180 |
|
return(nf); |
211 |
|
{ |
212 |
|
/* binary output? */ |
213 |
|
if (bocols > 0) { |
214 |
< |
fwrite(field, sizeof(double), n, fp); |
214 |
> |
putbinary(field, sizeof(double), n, fp); |
215 |
|
return; |
216 |
|
} |
217 |
|
if (bocols < 0) { |
218 |
|
float fv; |
219 |
|
while (n-- > 0) { |
220 |
|
fv = *field++; |
221 |
< |
fwrite(&fv, sizeof(float), 1, fp); |
221 |
> |
putbinary(&fv, sizeof(float), 1, fp); |
222 |
|
} |
223 |
|
return; |
224 |
|
} |
228 |
|
if (n) fputc(tabc, fp); |
229 |
|
} |
230 |
|
fputc('\n', fp); |
231 |
+ |
if (!subtotal) |
232 |
+ |
fflush(fp); /* flush unless -r */ |
233 |
|
} |
234 |
|
|
235 |
|
|
329 |
|
break; |
330 |
|
if (!subtotal) |
331 |
|
ltotal = 0; |
332 |
+ |
if (incnt > 0 && nlin >= incnt) |
333 |
+ |
break; |
334 |
|
} |
335 |
|
/* close input */ |
336 |
< |
return(fclose(fp)); |
336 |
> |
return(fclose(fp) == EOF ? 1 : 0); |
337 |
|
} |