Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby21
/
share
/
ri
/
2.1.0
/
system
/
ARGF
/
//opt/alt/ruby21/share/ri/2.1.0/system/ARGF/read-i.ri
U:RDoc::AnyMethod[iI" read:ETI"ARGF#read;TF:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Verbatim; [I"IReads _length_ bytes from ARGF. The files named on the command line ;TI"Kare concatenated and treated as a single file by this method, so when ;TI"Ocalled without arguments the contents of this pseudo file are returned in ;TI"their entirety. ;TI" ;TI"I_length_ must be a non-negative integer or nil. If it is a positive ;TI"Jinteger, +read+ tries to read at most _length_ bytes. It returns nil ;TI"Iif an EOF was encountered before anything could be read. Fewer than ;TI"N_length_ bytes may be returned if an EOF is encountered during the read. ;TI" ;TI"IIf _length_ is omitted or is _nil_, it reads until EOF. A String is ;TI"Breturned even if EOF is encountered before any data is read. ;TI" ;TI"+If _length_ is zero, it returns _""_. ;TI" ;TI"OIf the optional _outbuf_ argument is present, it must reference a String, ;TI""which will receive the data. ;TI"QThe <i>outbuf</i> will contain only the received data after the method call ;TI"/even if it is not empty at the beginning. ;T:@format0o:RDoc::Markup::Paragraph; [I"For example:;To:RDoc::Markup::BlankLine o; ; [I"# $ echo "small" > small.txt ;TI"# $ echo "large" > large.txt ;TI") $ ./glark.rb small.txt large.txt ;TI" ;TI"* ARGF.read #=> "small\nlarge" ;TI"* ARGF.read(200) #=> "small\nlarge" ;TI" ARGF.read(2) #=> "sm" ;TI" ARGF.read(0) #=> "" ;TI" ;TI"PNote that this method behaves like fread() function in C. If you need the ;TI"Dbehavior like read(2) system call, consider +ARGF.readpartial+.;T;0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"AARGF.read([length [, outbuf]]) -> string, outbuf, or nil ;T0[ I"(p1 = v1, p2 = v2);T@1FI" ARGF;TcRDoc::NormalClass00