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