Mega Code Archive

 
Categories / Ruby / File Directory
 

To create a new IO stream named ios, use the new method

# The first argument is 1, which is the numeric file descriptor for standard input.  # Standard input can also be represented by the predefined Ruby variable $stdin.  # The optional second argument, w, is a mode string meaning "write." ios = IO.new( 1, "w" ) ios.puts "IO, IO, it's off to the computer lab I go." $stdout.puts "Do you copy?"