home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
3
/
3648
/
fngetlin.c
next >
Wrap
C/C++ Source or Header
|
1991-07-16
|
407b
|
25 lines
/* this version of fgetline does not return the trailing newline */
/* $Date: 91/06/30 17:46:48 $ */
#include <stdio.h>
static char Rcsid[] = "$What: <@(#) fngetlin.c,v 2.1> $";
fngetline(fp, s, lim)
FILE *fp;
char *s;
int lim;
{
int c,i;
i = 0;
while (--lim > 0 && (c = getc(fp)) != EOF && c != '\n')
s[i++] = (char) c;
#if 0
if (c == '\n')
s[i++] = (char) c;
#endif
s[i] = '\0';
return i;
}