diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-05 11:27:06 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-05 11:27:06 +0000 |
commit | b92b89c5cb6297702cbfa6e57c61cb75733b39f7 (patch) | |
tree | 1db2f97528ace1dc5c5bc4a97458ae5ac9c6552f | |
parent | 1167b939f2d1a4ed56316fdb044ec105670f9126 (diff) | |
download | ruby-b92b89c5cb6297702cbfa6e57c61cb75733b39f7.tar.gz ruby-b92b89c5cb6297702cbfa6e57c61cb75733b39f7.tar.xz ruby-b92b89c5cb6297702cbfa6e57c61cb75733b39f7.zip |
rdoc update.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | io.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -6289,7 +6289,7 @@ rb_io_stdio_file(rb_io_t *fptr) * * Returns a new <code>IO</code> object (a stream) for the given * <code>IO</code> object or integer file descriptor and mode - * string. See also <code>IO#fileno</code> and + * string. See also <code>IO.sysopen</code> and * <code>IO.for_fd</code>. * * === Parameters @@ -6334,7 +6334,8 @@ rb_io_stdio_file(rb_io_t *fptr) * * === Example1 * - * a = IO.new(2,"w") # '2' is standard error + * fd = IO.sysopen("/dev/tty", "w") + * a = IO.new(fd,"w") * $stderr.puts "Hello" * a.puts "World" * @@ -6344,10 +6345,15 @@ rb_io_stdio_file(rb_io_t *fptr) * World * * === Example2 - * io = IO.new(2, mode: 'w:UTF-16LE', cr_newline: true) + * + * require 'fcntl' + * + * fd = STDERR.fcntl(Fcntl::F_DUPFD) + * io = IO.new(fd, mode: 'w:UTF-16LE', cr_newline: true) * io.puts "Hello, World!" * - * io = IO.new(2, mode: 'w', cr_newline: true, external_encoding: Encoding::UTF_16LE) + * fd = STDERR.fcntl(Fcntl::F_DUPFD) + * io = IO.new(fd, mode: 'w', cr_newline: true, external_encoding: Encoding::UTF_16LE) * io.puts "Hello, World!" * * both of aboves print "Hello, World!" in UTF-16LE to standard error output with |