home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d2xx
/
d254
/
etale.lha
/
Etale
/
bfgets.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-10-19
|
443b
|
26 lines
#include "exec/types.h"
#include "stdio.h"
UBYTE * bfgets(fgs, num, fp)
UBYTE *fgs;
SHORT num;
register FILE *fp;
{
register int c;
register UBYTE *cs;
cs = fgs;
while ( (--num > 0) && ( (c = getc(fp)) != EOF ) )
{
*cs++ = (UBYTE)c;
if (c==0)
{
cs--; /* throw nulls out */
num++;
}
if (c==0x0a) break; /* linefeed */
}
if (cs==fgs)
return(NULL);
*cs = '\0';
return(fgs);
}