Subversion Repositories Kolibri OS

Rev

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

Rev 647 Rev 6433
Line 1... Line 1...
1
#include 
1
#include 
2
int fgetc(FILE* file)
2
int fgetc(FILE* file)
3
{
3
{
4
	dword res;
4
	dword res;
-
 
5
    if(!file)
-
 
6
    {
-
 
7
        errno = E_INVALIDPTR;
-
 
8
        return EOF;
-
 
9
    }
Line 5... Line 10...
5
 
10
 
Line 6... Line 11...
6
	if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0)) return EOF;
11
	if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0)) return EOF;
7
 
12
 
Line 15... Line 20...
15
		if (res==0)
20
		if (res==0)
16
		{
21
		{
17
			file->filepos++;
22
			file->filepos++;
18
  			return (int)file->buffer[0];
23
  			return (int)file->buffer[0];
19
		}
24
		}
-
 
25
		else
-
 
26
        {
20
		else return(res);
27
            errno = -res;
-
 
28
            return EOF;  // errors are < 0
-
 
29
        }
21
	}
30
	}
22
}
31
}
23
32