home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
S
/
SMC21LIB.LZH
/
FREAD.C
< prev
next >
Wrap
Text File
|
2000-06-30
|
1KB
|
38 lines
#define NOCCARGC
#include clib.def
extern int _status[];
/*
** Item-stream read from fd.
** Entry: buf = address of target buffer
** sz = size of items in bytes
** n = number of items to read
** fd = file descriptor
** Returns a count of items actually read.
** Use feof() and ferror() to determine file status.
*/
fread(buf, sz, n, fd) char *buf; int sz, n, fd; {
return(read(fd, buf, n*sz));
}
/*
** Binary-stream read from fd.
** Entry: fd = file descriptor
** buf = address of target buffer
** n = number of bytes to read
** Returns a count of items actually read
** Use feof() and ferror() to determine file status.
*/
read(fd, buf, n) int fd, n; char *buf; {
char *cnt; /*fake unsigned*/
cnt = 0;
while(n--) {
*buf++ = _read(fd);
if(_status[fd] & (ERRBIT | EOFBIT)) break;
++cnt;
}
return (cnt);
}