forked from KolibriOS/kolibrios
af35cc6783
git-svn-id: svn://kolibrios.org@6424 a494cfbc-eb01-0410-851d-a64ba20cac60
26 lines
347 B
C
26 lines
347 B
C
#include <stdio.h>
|
|
|
|
char * fgets ( char * str, int num, FILE * stream )
|
|
{
|
|
int rd = 0;
|
|
char c;
|
|
while (rd < num - 1)
|
|
{
|
|
c = fgetc(stream);
|
|
if (EOF == c) break;
|
|
if ('\n' == c)
|
|
{
|
|
str[rd++] = c;
|
|
break;
|
|
}
|
|
else
|
|
str[rd++] = c;
|
|
}
|
|
if (0 == rd) return NULL;
|
|
else
|
|
{
|
|
str[rd] = '\0';
|
|
return str;
|
|
}
|
|
}
|