mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[DOC] Use File.open with block instead of File.new without close [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9fe26ef8de
commit
13247fa417
1 changed files with 4 additions and 3 deletions
3
io.c
3
io.c
|
@ -5175,8 +5175,9 @@ internal_pwrite_func(void *ptr)
|
||||||
* Raises <code>SystemCallError</code> on error and <code>NotImplementedError</code>
|
* Raises <code>SystemCallError</code> on error and <code>NotImplementedError</code>
|
||||||
* if platform does not implement the system call.
|
* if platform does not implement the system call.
|
||||||
*
|
*
|
||||||
* f = File.new("out", "w")
|
* File.open("out", "w") do |f|
|
||||||
* f.pwrite("ABCDEF", 3) #=> 6
|
* f.pwrite("ABCDEF", 3) #=> 6
|
||||||
|
* end
|
||||||
*
|
*
|
||||||
* File.read("out") #=> "\u0000\u0000\u0000ABCDEF"
|
* File.read("out") #=> "\u0000\u0000\u0000ABCDEF"
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue