# How to convert an IOBuffer to an IOStream?

**URL:** <https://discourse.julialang.org/t/how-to-convert-an-iobuffer-to-an-iostream/11801>\
**Category:** General Usage\
**Created:** [June 19, 2018, 10:18pm UTC](https://discourse.julialang.org/t/how-to-convert-an-iobuffer-to-an-iostream/11801 "2018-06-19T22:18:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nabla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nabla/32/26089_2.png) [@nabla](https://discourse.julialang.org/u/nabla)\
**Post date:** [June 19, 2018, 10:18pm UTC](https://discourse.julialang.org/t/how-to-convert-an-iobuffer-to-an-iostream/11801/1 "2018-06-19T22:18:38Z")

</div>

Hi there,  
I would like to feed a string as standard input to a command; a silly example is that I want to print “b” as follows:

```julia
julia> input = IOBuffer("a")
julia> open(`tr a b`, "r", input) do output
    print(readline(output))
end

```

however I get weird error messages: in 0.6,  
ERROR: MethodError: no method matching uvtype(::Base.AbstractIOBuffer{Array{UInt8,1}})  
and in 0.7.0-DEV.5260,  
ERROR: MethodError: no method matching rawhandle(::Base.GenericIOBuffer{Array{UInt8,1}})

so it seems that although I can read from an IOBuffer I can’t pass it as stdio to open.

There must be a way to encapsulate the IOBuffer into an IOStream, but I haven’t found it.
