|
|
1.1 root 1: #include <stdio.h>
2:
3: fread(ptr, size, count, iop)
4: unsigned size, count;
5: register char *ptr;
6: register FILE *iop;
7: {
8: register c;
9: unsigned ndone, s;
10:
11: ndone = 0;
12: if (size)
13: for (; ndone<count; ndone++) {
14: s = size;
15: do {
16: if ((c = getc(iop)) >= 0)
17: *ptr++ = c;
18: else
19: return(ndone);
20: } while (--s);
21: }
22: return(ndone);
23: }
24:
25: fwrite(ptr, size, count, iop)
26: unsigned size, count;
27: register char *ptr;
28: register FILE *iop;
29: {
30: register unsigned s;
31: unsigned ndone;
32:
33: ndone = 0;
34: if (size)
35: for (; ndone<count; ndone++) {
36: s = size;
37: do {
38: putc(*ptr++, iop);
39: } while (--s);
40: if (ferror(iop))
41: break;
42: }
43: return(ndone);
44: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.