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.

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

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

read

ARGF.read([length [, outbuf]]) â string, outbuf, or nil Instance Public methods Reads _length_ bytes from ARGF. The files named on the command line are concatenated and treated as a single file by this method, so when called without arguments the contents of this pseudo file are returned in their entirety. _length_ must be a non-negative integer or nil. If it is a positive integer, +read+ tries to read at most _length_ bytes. It returns nil if an EOF was encountered before any

read_nonblock

ARGF.read_nonblock(maxlen) â stringARGF.read_nonblock(maxlen, outbuf) â outbuf Instance Public methods Reads at most maxlen bytes from the ARGF stream in non-blocking mode.

readbyte

ARGF.readbyte â Fixnum Instance Public methods Reads the next 8-bit byte from ARGF and returns it as a Fixnum. Raises an EOFError after the last byte of the last file has been read. For example: $ echo "foo" > file $ ruby argf.rb file ARGF.readbyte #=> 102 ARGF.readbyte #=> 111 ARGF.readbyte #=> 111 ARGF.readbyte #=> 10 ARGF.readbyte #=> end of file reached (EOFError)

readchar

ARGF.readchar â String or nil Instance Public methods Reads the next character from ARGF and returns it as a String. Raises an EOFError after the last character of the last file has been read. For example: $ echo "foo" > file $ ruby argf.rb file ARGF.readchar #=> "f" ARGF.readchar #=> "o" ARGF.readchar #=> "o" ARGF.readchar #=> "\n" ARGF.readchar #=> end of file reached (EOFError)

readline

ARGF.readline(sep=$/) â stringARGF.readline(limit) â stringARGF.readline(sep, limit) â string Instance Public methods Returns the next line from the current file in ARGF. By default lines are assumed to be separated by +$/+; to use a different character as a separator, supply it as a String for the sep argument. The optional limit argument specifies how many characters of each line to return. By default all characters are returned. An EOFError is raised at the end of the

readlines

ARGF.readlines(sep=$/) â arrayARGF.readlines(limit) â arrayARGF.readlines(sep, limit) â array Instance Public methods Reads ARGF's current file in its entirety, returning an Array of its lines, one line per element. Lines are assumed to be separated by sep. lines = ARGF.readlines lines[0] #=> "This is line one\n"

readpartial

ARGF.readpartial(maxlen) â stringARGF.readpartial(maxlen, outbuf) â outbuf Instance Public methods Reads at most maxlen bytes from the ARGF stream. It blocks only if ARGF has no data immediately available. If the optional outbuf argument is present, it must reference a String, which will receive the data. The outbuf will contain only the received data after the method call even if it is not empty at the beginning. It raises EOFError on end of file. readpartial is