julia version 0.3.3 julia> rdstdout, wrstdout = redirect_stdout() (Pipe(open, 0 bytes waiting),Pipe(open, 0 bytes waiting))
julia> print("hello") julia> s = readavailable(rdstdout) "hello" Using a IOBuffer() is more idiomatic though. Look at the source of the filter function for an example. It is in string.jl. Whatever, here it is: function filter(f::Function, s::String) out = IOBuffer(Array(Uint8,endof(s)),true,true) truncate(out,0) for c in s if f(c) write(out, c) end end takebuf_string(out) end