write 2

ios.write(string) â integer
Instance Public methods

Writes the given string to ios. The stream must be opened for writing. If the argument is not a string, it will be converted to a string using to_s. Returns the number of bytes written.

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
doc_ruby_on_rails
2015-04-13 15:23:17
Comments
Leave a Comment

Please login to continue.