# Redirect stderr/out to IOBuffer()

**URL:** <https://discourse.julialang.org/t/redirect-stderr-out-to-iobuffer/23984>\
**Category:** General Usage\
**Created:** [May 8, 2019, 4:04am UTC](https://discourse.julialang.org/t/redirect-stderr-out-to-iobuffer/23984 "2019-05-08T04:04:04Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [May 10, 2019, 2:39am UTC](https://discourse.julialang.org/t/redirect-stderr-out-to-iobuffer/23984/6 "2019-05-10T02:39:39Z")

</div>

> [@Pbellive](#):
>
> The write method (currently defined at line 576 of base/io.jl) is undocumented. Is it not intended for general use?

Type `?write` and you will find that it [is documented](https://docs.julialang.org/en/latest/base/io-network/#Base.write).

Basically, you use `write` for writing raw binary data and `print` for writing textual representations. `write(io, "foo")` and `print(io, "foo")` do the same thing for most `io` objects, because `"foo"` is already text, but potentially the `io` object might change the text encoding if you are using `print`. See also [this thread](https://discourse.julialang.org/t/difference-between-write-and-print/6943/2).

_Edit_: Oh, I see that you are referring specifically to the `write(to::IO, from::IO)` method. Yes, that is undocumented right now, but maybe we should document it? A PR would be a welcome place to discuss it.

---

_[View the full topic](https://discourse.julialang.org/t/redirect-stderr-out-to-iobuffer/23984)._
