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
/
CPM
/
BDSC
/
BDSC-4
/
BDSLIB.ARK
/
GETW.C
< prev
next >
Wrap
Text File
|
1983-07-15
|
896b
|
37 lines
/*
* getw
* This function returns the next 16 bit object from the specified
* stream. One must call feof() and ferror() to determine whether or
* not the value returned is (-1) or an error has occurred. This was
* bad planning on the part of the designer of the U**X Library. This
* function is essentially unchanged from the BDS C function of the
* the same name.
* Last Edit 6/6/83
*/
unsigned
getw(stream)
FILE *stream;
{
int a,b;
if (((a=getc(stream)) >= 0) && ((b= getc(stream)) >=0))
return 256*b+a;
return ERROR;
}
/*
* putw
* This function appends a 16 bit object to `stream'. It is
* is identical to the function in the BDS C Standard Library.
* Last Edit 6/6/83
*/
putw(w,stream)
unsigned w;
FILE *stream;
{
if ((putc(w%256,stream) >=0 ) && (putc(w / 256,stream) >= 0))
return w;
return ERROR;
}