# Io.write with buffer size?

**URL:** <https://www.ruby-forum.com/t/io-write-with-buffer-size/99268>\
**Category:** Ruby\
**Created:** [July 21, 2006, 12:30pm UTC](https://www.ruby-forum.com/t/io-write-with-buffer-size/99268 "2006-07-21T12:30:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 21, 2006, 12:30pm UTC](https://www.ruby-forum.com/t/io-write-with-buffer-size/99268/1 "2006-07-21T12:30:31Z")

</div>

Hello all,

is there a way to do an io.write _with a certain buffer size_ ?

I need to do the same as somebody else did in TcL like this:

fconfigure $file -buffersize 16 -buffering none -encoding binary  
-translation binary

puts -nonewline $file [binary format “h\*” $string]

Thanks

Axel

OS: Linux  
Ruby 1.8.4

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 21, 2006, 12:52pm UTC](https://www.ruby-forum.com/t/io-write-with-buffer-size/99268/2 "2006-07-21T12:52:30Z")

</div>

On 7/21/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> puts -nonewline $file [binary format “h\*” $string]
> 
> Thanks

Not as such I am afraid.

If you do a write of your data having the size you need and flush the  
stream, is that not good enough?  
If I understand correctly you have alas no control over the OS buffer of  
the  
underlying stream. flushing the stream empties the Ruby buffer but not  
more.

Cheers  
Robert

Axel

> OS: Linux  
> Ruby 1.8.4

–  
Deux choses sont infinies : l’univers et la bÃªtise humaine ; en ce qui  
concerne l’univers, je n’en ai pas acquis la certitude absolue.

- Albert Einstein
