home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume24
/
mkid2
/
part01
/
gets0.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-09
|
575b
|
31 lines
/* Copyright (c) 1986, Greg McGary */
static char sccsid[] = "@(#)gets0.c 1.1 86/10/09";
#include <stdio.h>
int fgets0();
/*
This is like fgets(3s), except that lines are
delimited by NULs rather than newlines. Also,
we return the number of characters gotten rather
than the address of buf0.
*/
int
fgets0(buf0, size, inFILE)
char *buf0;
int size;
register FILE *inFILE;
{
register char *buf;
register int c;
register char *end;
buf = buf0;
end = &buf[size];
while ((c = getc(inFILE)) > 0 && buf < end)
*buf++ = c;
*buf = '\0';
return (buf - buf0);
}