Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include <stdio.h>
  2. int fgetc(FILE* file)
  3. {
  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.         {
  10.                 return EOF;
  11.         }
  12.         else
  13.         {
  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);
  21.         }
  22. }