D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
IO
/
Filename :
write-c.ri
back
Copy
U:RDoc::AnyMethod[iI" write:ETI"IO::write;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"6Opens the stream, writes the given +data+ to it, ;TI"@and closes the stream; returns the number of bytes written.;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"WWith only argument +path+ given, writes the given +data+ to the file at that path:;T@o:RDoc::Markup::Verbatim; [I"(IO.write('t.tmp', 'abc') # => 3 ;TI",File.read('t.tmp') # => "abc" ;T:@format0o; ; [I"@If +offset+ is zero (the default), the file is overwritten:;T@o;; [I"(IO.write('t.tmp', 'A') # => 1 ;TI"*File.read('t.tmp') # => "A" ;T; 0o; ; [I"LIf +offset+ in within the file content, the file is partly overwritten:;T@o;; [ I"(IO.write('t.tmp', 'abcdef') # => 3 ;TI"/File.read('t.tmp') # => "abcdef" ;TI"# Offset within content. ;TI"(IO.write('t.tmp', '012', 2) # => 3 ;TI"/File.read('t.tmp') # => "ab012f" ;T; 0o; ; [I".If +offset+ is outside the file content, ;TI"?the file is padded with null characters <tt>"\u0000"</tt>:;T@o;; [I")IO.write('t.tmp', 'xyz', 10) # => 3 ;TI"KFile.read('t.tmp') # => "ab012f\u0000\u0000\u0000\u0000xyz" ;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"<IO.write(path, data, offset = 0, **opts) -> integer ;T0[ I"(*args);T@GFI"IO;TcRDoc::NormalClass00