home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
mint
/
mntlib16.lzh
/
MNTLIB16
/
GETW.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-03
|
948b
|
62 lines
#include <stdio.h>
short getw(fp)
register FILE *fp;
{
register short n, c;
if((c = getc(fp)) == EOF)
return(EOF);
n = (c << 8);
if((c = getc(fp)) == EOF)
return(EOF);
n |= (c & 0xFF);
return(n);
}
#ifdef __STDC__
short putw(short n, FILE *fp)
#else
short putw(n, fp)
register short n;
register FILE *fp;
#endif
{
register short m;
m = (n >> 8);
if(fputc((m & 0xFF), fp) == EOF)
return(EOF);
if(fputc((n & 0xFF), fp) == EOF)
return(EOF);
return(n);
}
long getl(fp)
register FILE *fp;
{
register long n, c;
if((c = getw(fp)) == EOF)
return(EOF);
n = (c << 16);
if((c = getw(fp)) == EOF)
return(EOF);
n |= (c & 0xFFFF);
return(n);
}
long putl(n, fp)
register long n;
register FILE *fp;
{
register long m;
m = (n >> 16);
if(putw((m & 0xFFFFL), fp) == EOF)
return(EOF);
if(putw((n & 0xFFFFL), fp) == EOF)
return(EOF);
return(n);
}