Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6424 siemargl 1
#include 
2
 
3
char * fgets ( char * str, int num, FILE * stream )
4
{
5
	int rd = 0;
6
	char c;
7
	while (rd < num - 1)
8
	{
9
		c = fgetc(stream);
10
		if (EOF == c) break;
11
		if ('\n' == c)
12
		{
13
			str[rd++] = c;
14
			break;
15
		}
16
		else
17
			str[rd++] = c;
18
	}
19
	if (0 == rd) return NULL;
20
	else
21
	{
22
		str[rd] = '\0';
23
		return str;
24
	}
25
}