# @code\_native output to file

**URL:** <https://discourse.julialang.org/t/code-native-output-to-file/99900>\
**Category:** New to Julia\
**Created:** [June 5, 2023, 4:12pm UTC](https://discourse.julialang.org/t/code-native-output-to-file/99900 "2023-06-05T16:12:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Post date:** [June 5, 2023, 4:12pm UTC](https://discourse.julialang.org/t/code-native-output-to-file/99900/1 "2023-06-05T16:12:25Z")

</div>

Hi,  
Is there a way to save the output of `@code_native` to a txt file?  
My ouput is very long and I can’t copy it manually to a file because it is more than the terminal buffer.  
Thank you

---

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [June 5, 2023, 4:33pm UTC](https://discourse.julialang.org/t/code-native-output-to-file/99900/2 "2023-06-05T16:33:58Z")

</div>

I’m not sure if there’s a way to do this via the macro syntax, but you can use the function syntax to specify the `io` destination:

```julia
help?> code_native
search: code_native @code_native

  code_native([io=stdout,], f, types; syntax=:att, debuginfo=:default, binary=false, dump_module=true)

  Prints the native assembly instructions generated for running the method matching
  the given generic function and type signature to io.

```

The translation of `@code_native f(a,b)` is roughly `code_native(stdout, f, typeof((a,b)))`. Replace `stdout` with a file handle (created via `open`) to dump to a file, for example.
