[Bug:1.9] rb_io_fread does not work

e$B1sF#$G$9!#e(B

DEPRECATED(int rb_getc(FILE*));
DEPRECATED(long rb_io_fread(char *, long, FILE *));
DEPRECATED(long rb_io_fwrite(const char *, long, FILE ));
DEPRECATED(int rb_read_pending(FILE
));

e$B$H$$$&$N$,e(B ruby/io.h e$B$K$"$j$^$9$,!";n$7$K$3$l$i$r;H$C$F$_$?e(B
e$B$H$3$m!"%$%s%?%W%j%?$,%U%j!<%:$7$^$7$?!#e(B

$ …/ruby -rfoo -e ‘foo’
(^C e$B$,8z$+$J$$e(B)

e$B<B:]!"e(Brb_io_fread e$B$,e(B io_fread
e$B$r8F$S!“e(BREAD_DATA_PENDING e$B$Ge(B
e$BL$=i4|2=$Ne(B rbuf_len e$B$r;2>H$7$F$$$F!”$^$H$b$KF0$/$h$&$J46$8e(B
e$B$G$O$J$$$h$&$K8+$($^$7$?!#e(B
rb_io_fwrite e$B$bF0$$$F$$$J$$$h$&$J5$$,$7$^$9!#e(B

README.EXT e$B$K5-:$5$l$F$$$J$$$N$G$"$l$P!"CfESH>C<$K;D$9$h$je(B
e$B:o=|$7$F$7$^$C$?$i$I$&$G$7$g$&$+!#e(B

e$B0J2<!"8!>Z$K;H$C$?%3!<%I$G$9!#e(B
e$B$b$7;H$$J}$,4V0c$C$F$$$?$i$9$_$^$;$s!#e(B

#include “ruby.h”
#include “ruby/io.h”

VALUE foo(VALUE self)
{
int i;
char buf[11];
FILE *fp;

fp = fopen(“foo”, “r+”);
i = rb_io_fread(buf, 10, fp);
buf[i] = ‘\0’;
fclose(fp);
printf(""%s"\n", buf);

/*
fp = fopen(“bar”, “w”);
rb_io_fwrite(“foobarbaz\n”, 10, fp);
fflush(fp);
fclose(fp);
*/

return Qnil;
}

void Init_foo()
{
rb_define_global_function(“foo”, foo, 0);
}

e$B%A%1%C%He(B #625 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r19805.

http://redmine.ruby-lang.org/issues/show/625