# How to redirect to "nothing" the standard output of a function I call?

**URL:** <https://discourse.julialang.org/t/how-to-redirect-to-nothing-the-standard-output-of-a-function-i-call/49106>\
**Category:** New to Julia\
**Created:** [October 27, 2020, 9:31am UTC](https://discourse.julialang.org/t/how-to-redirect-to-nothing-the-standard-output-of-a-function-i-call/49106 "2020-10-27T09:31:30Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [September 27, 2021, 12:26am UTC](https://discourse.julialang.org/t/how-to-redirect-to-nothing-the-standard-output-of-a-function-i-call/49106/4 "2021-09-27T00:26:09Z")

</div>

Putting the last two answers together more concisely…

```julia
redirect_stdout(devnull) do ... end

```

**EDIT** : Should have tested it, it does not work ☹. This does:

```julia
redirect_stdout(open(tempname(), "w")) do; println(1) end

```

although it’s clearly suboptimal. I’d love to get an answer to [this question](https://discourse.julialang.org/t/how-to-convert-an-iobuffer-to-an-iostream/11801)…

---

_[View the full topic](https://discourse.julialang.org/t/how-to-redirect-to-nothing-the-standard-output-of-a-function-i-call/49106)._
