2007-08-24 21:49:07 +02:00
|
|
|
#include <stdio.h>
|
2006-09-07 16:14:53 +02:00
|
|
|
int fgetc(FILE* file)
|
|
|
|
{
|
2007-08-24 21:49:07 +02:00
|
|
|
dword res;
|
|
|
|
|
|
|
|
if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0)) return EOF;
|
|
|
|
|
2006-09-07 16:14:53 +02:00
|
|
|
if (file->filepos>=file->filesize)
|
2007-08-24 21:49:07 +02:00
|
|
|
{
|
|
|
|
return EOF;
|
|
|
|
}
|
2006-09-07 16:14:53 +02:00
|
|
|
else
|
|
|
|
{
|
2007-08-24 21:49:07 +02:00
|
|
|
res=_ksys_readfile(file->filename,file->filepos,1,file->buffer);
|
|
|
|
if (res==0)
|
|
|
|
{
|
|
|
|
file->filepos++;
|
|
|
|
return (int)file->buffer[0];
|
|
|
|
}
|
|
|
|
else return(res);
|
2006-09-07 16:14:53 +02:00
|
|
|
}
|
|
|
|
}
|