io.rb: add IO#readbyte; ref #5389

This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-04-10 19:04:58 +09:00
parent 167e0b3f4f
commit 8fa1ff9a03
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ Add the line below to your build configuration.
| IO#puts | o | |
| IO#read | o | |
| IO#read_nonblock | | |
| IO#readbyte | | |
| IO#readbyte | o | |
| IO#readchar | o | |
| IO#readline | o | |
| IO#readlines | o | |
+5
View File
@@ -299,6 +299,11 @@ class IO
end
end
def readbyte
_read_buf
IO._bufread(@buf, 1).getbyte(0)
end
def getbyte
ret = getc
return ret.getbyte 0 if ret