D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
IO
/
Filename :
read-c.ri
back
Copy
U:RDoc::AnyMethod[iI" read:ETI" IO::read;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"EOpens the stream, reads and returns some or all of its content, ;TI"@and closes the stream; returns +nil+ if no bytes were read.;To:RDoc::Markup::BlankLine o; ; [I"=When called from class \IO (but not subclasses of \IO), ;TI"Xthis method has potential security vulnerabilities if called with untrusted input; ;TI">see {Command Injection}[rdoc-ref:command_injection.rdoc].;T@o; ; [I"DThe first argument must be a string that is the path to a file.;T@o; ; [I"XWith only argument +path+ given, reads in text mode and returns the entire content ;TI"#of the file at the given path:;T@o:RDoc::Markup::Verbatim; [I"IO.read('t.txt') ;TI"A# => "First line\nSecond line\n\nThird line\nFourth line\n" ;T:@format0o; ; [I"MOn Windows, text mode can terminate reading and leave bytes in the file ;TI"Dunread when encountering certain special bytes. Consider using ;TI"8IO.binread if all bytes in the file should be read.;T@o; ; [I"AWith argument +length+, returns +length+ bytes if available:;T@o;; [I"(IO.read('t.txt', 7) # => "First l" ;TI"IO.read('t.txt', 700) ;TI"K# => "First line\r\nSecond line\r\n\r\nFourth line\r\nFifth line\r\n" ;T; 0o; ; [I"BWith arguments +length+ and +offset+, returns +length+ bytes ;TI"3if available, beginning at the given +offset+:;T@o;; [I"2IO.read('t.txt', 10, 2) # => "rst line\nS" ;TI"(IO.read('t.txt', 10, 200) # => nil ;T; 0o; ; [I"/Optional keyword arguments +opts+ specify:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I".{Open Options}[rdoc-ref:IO@Open+Options].;To;;0; [o; ; [I"B{Encoding options}[rdoc-ref:encodings.rdoc@Encoding+Options].;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"IIO.read(path, length = nil, offset = 0, **opts) -> string or nil ;T0[ I"-(p1, p2 = v2, p3 = v3, p4 = v4, p5 = {});T@DFI"IO;TcRDoc::NormalClass00