Ruby1.8, Ruby1.9のIOの挙動の違い

投稿者 nanki 2010-04-28 04:47:00 GMT

表にまとめてみた。 主な違いは、getc/readcharがbyteを返すだけみたいだ。

getchar/getlineがあってほしい((# getcは数値を返して欲しい))

get - nil at EOFread - EOFError at EOFenumeach
(char) 1.8 N/A N/A chars each_char
1.9 getc readchar chars each_char
(byte) 1.8 getbyte, getc readbyte, readchar bytes each_byte
1.9 getbyte readbyte bytes each_byte
(line) 1.8 gets readline lines each_line, each
1.9 gets readline lines each_line, each

This entry was posted on 2010-04-28 04:47:00 GMT and カテゴリ . You can follow any response to this entry through the Atom feed. or a trackback from your own site.