__toread.c 391 字节
Newer Older
1 2 3 4 5 6 7
#include <stdio_impl.h>

int __toread(FILE *f)
{
	f->mode |= f->mode-1;
	if (f->wpos > f->buf) f->write(f, 0, 0);
	f->wpos = f->wbase = f->wend = 0;
8 9
	if (f->flags & F_NORD) {
		f->flags |= F_ERR;
10 11
		return EOF;
	}
12 13
	f->rpos = f->rend = f->buf + f->buf_size;
	return (f->flags & F_EOF) ? EOF : 0;
14
}
15

16
void __stdio_exit_needed(void);
17

18
void __toread_needs_stdio_exit()
19
{
20
	__stdio_exit_needed();
21
}