Subversion Repositories Kolibri OS

Rev

Rev 6424 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6424 Rev 6433
Line 1... Line 1...
1
#include 
1
#include 
Line 2... Line 2...
2
 
2
 
-
 
3
char * fgets ( char * str, int num, FILE * file )
3
char * fgets ( char * str, int num, FILE * stream )
4
// need to ignore \r\n in text mode
4
{
5
{
5
	int rd = 0;
6
	int rd = 0;
-
 
7
	char c;
-
 
8
 
-
 
9
    if(!file || !str)
-
 
10
    {
-
 
11
        errno = E_INVALIDPTR;
-
 
12
        return NULL;
-
 
13
    }
-
 
14
 
6
	char c;
15
 
7
	while (rd < num - 1) 
16
	while (rd < num - 1)
8
	{
17
	{
9
		c = fgetc(stream);
18
		c = fgetc(file);
10
		if (EOF == c) break;
19
		if (EOF == c) break;
11
		if ('\n' == c)
20
		if ('\n' == c)
12
		{
21
		{
13
			str[rd++] = c;
22
			str[rd++] = c;