read 2

ios.read([length [, outbuf]]) â string, outbuf, or nil Instance Public methods Reads length bytes from the I/O stream. length must be a non-negative integer or nil. If length is a positive integer, it try to read length bytes without any conversion (binary mode). It returns nil or a string whose length is 1 to length bytes. nil means it met EOF at beginning. The 1 to length-1 bytes string means it met EOF after reading the result. The length bytes string means it doesn't meet E

raw!

io.raw!(min: nil, time: nil) Instance Public methods Enables raw mode. If the terminal mode needs to be back, use io.raw { ⦠}. You must require 'io/console' to use this method.

raw

io.raw(min: nil, time: nil) {|io| } Instance Public methods Yields self within raw mode. STDIN.raw(&:gets) will read and return a line without echo back and line editing. You must require 'io/console' to use this method.

puts

ios.puts(obj, ...) â nil Instance Public methods Writes the given objects to ios as with IO#print. Writes a record separator (typically a newline) after any that do not already end with a newline sequence. If called with an array argument, writes each element on a new line. If called without arguments, outputs a single record separator. $stdout.puts("this", "is", "a", "test") produces: this is a test

putc

ios.putc(obj) â obj Instance Public methods If obj is Numeric, write the character whose code is the least-significant byte of obj, otherwise write the first byte of the string representation of obj to ios. Note: This method is not safe for use with multi-byte characters as it will truncate them. $stdout.putc "A" $stdout.putc 65 produces: AA

printf

ios.printf(format_string [, obj, ...]) â nil Instance Public methods Formats and writes to ios, converting parameters under control of the format string. See Kernel#sprintf for details.

print

ios.print() â nilios.print(obj, ...) â nil Instance Public methods Writes the given object(s) to ios. The stream must be opened for writing. If the output field separator ($,) is not nil, it will be inserted between each object. If the output record separator ($\) is not nil, it will be appended to the output. If no arguments are given, prints $_. Objects that aren't strings will be converted by calling their to_s method. With no argument, prints the contents of th

pos=

ios.pos = integer â integer Instance Public methods Seeks to the given position (in bytes) in ios. It is not guranteed that seeking to the right position when ios is textmode. f = File.new("testfile") f.pos = 17 f.gets #=> "This is line two\n"

pos

ios.pos â integer Instance Public methods Returns the current offset (in bytes) of ios. f = File.new("testfile") f.pos #=> 0 f.gets #=> "This is line one\n" f.pos #=> 17

pid

ios.pid â fixnum Instance Public methods Returns the process ID of a child process associated with ios. This will be set by IO.popen. pipe = IO.popen("-") if pipe $stderr.puts "In parent, child pid is #{pipe.pid}" else $stderr.puts "In child, pid is #{$$}" end produces: In child, pid is 26209 In parent, child pid is 26209