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.

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

produces:

1
2
This is a test
That was 15 bytes of data
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.