Subversion Repositories Kolibri OS

Rev

Rev 145 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
610 andrew_pro 1
#include 
145 halyavin 2
int fgetc(FILE* file)
3
{
610 andrew_pro 4
	dword res;
5
 
6
	if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0)) return EOF;
7
 
8
	if (file->filepos>=file->filesize)
9
	{
145 halyavin 10
		return EOF;
610 andrew_pro 11
	}
145 halyavin 12
	else
13
	{
610 andrew_pro 14
		res=_ksys_readfile(file->filename,file->filepos,1,file->buffer);
15
		if (res==0)
16
		{
17
			file->filepos++;
18
  			return (int)file->buffer[0];
19
		}
20
		else return(res);
145 halyavin 21
	}
22
}