Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
6432 siemargl 1
#include 
2
// non standard realization - no support for virtually change char
3
int ungetc(int c,FILE* file)
4
{
5
	dword res;
6
 
6433 siemargl 7
    if(!file)
8
    {
9
        errno = E_INVALIDPTR;
10
        return EOF;
11
    }
6432 siemargl 12
 
6433 siemargl 13
	if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0))
14
    {
15
        errno = E_ACCESS;
16
        return EOF;
17
    }
18
 
6432 siemargl 19
	if (file->filepos>file->filesize || file->filepos==0)
20
	{
6433 siemargl 21
	    errno = E_EOF;
6432 siemargl 22
		return EOF;
23
	}
24
	file->filepos--;
25
 
26
	return c;
6433 siemargl 27
}