write(*args) public

Writes the given strings to ios. The stream must be opened for writing. Arguments that are not a string will be converted to a string using to_s. Returns the number of bytes written in total.

count = $stdout.write("This is", " a test\n")
puts "That was #{count} bytes of data"

produces:

This is a test
That was 15 bytes of data
Show source
Register or log in to add new notes.