# Issues with println buffering output when redirecting stdout to a txt file

**URL:** <https://discourse.julialang.org/t/issues-with-println-buffering-output-when-redirecting-stdout-to-a-txt-file/23738>\
**Category:** General Usage\
**Created:** [May 1, 2019, 3:12pm UTC](https://discourse.julialang.org/t/issues-with-println-buffering-output-when-redirecting-stdout-to-a-txt-file/23738 "2019-05-01T15:12:45Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 2, 2019, 5:22am UTC](https://discourse.julialang.org/t/issues-with-println-buffering-output-when-redirecting-stdout-to-a-txt-file/23738/14 "2019-05-02T05:22:27Z")

</div>

> [@jonbarkerlondon](#):
>
> That would be nice, unfortunately we have a few thousand lines of julia code that i don’t want to do a find/replace in 🙂

Using a wrapper type would be a clean solution. Eg (just a starting point, modify/extend as needed):

```julia
struct FlushingIO{T}
    io::T
end

function Base.print(io::FlushingIO, args...)
    print(io.io, args...)
    flush(io.io)
end

out = FlushingIO(stdout)
my_function(out, ...)

```

---

_[View the full topic](https://discourse.julialang.org/t/issues-with-println-buffering-output-when-redirecting-stdout-to-a-txt-file/23738)._
