binread

IO.binread(name, [length [, offset]] ) â string
Class Public methods

Opens the file, optionally seeks to the given offset, then returns length bytes (defaulting to the rest of the file). binread ensures the file is closed before returning. The open mode would be ârb:ASCII-8BITâ.

IO.binread("testfile")           #=> "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
IO.binread("testfile", 20)       #=> "This is line one\nThi"
IO.binread("testfile", 20, 10)   #=> "ne one\nThis is line "
doc_ruby_on_rails
2015-04-13 08:32:11
Comments
Leave a Comment

Please login to continue.