# How to pass an IOBuffer to \`ccall\`

**URL:** https://discourse.julialang.org/t/how-to-pass-an-iobuffer-to-ccall/71547
**Category:** General Usage
**Created:** [November 16, 2021, 11:02am UTC](https://discourse.julialang.org/t/how-to-pass-an-iobuffer-to-ccall/71547 "2021-11-16T11:02:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![circonflexe](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@circonflexe](https://discourse.julialang.org/u/circonflexe)
#### Post date: [November 16, 2021, 11:02am UTC](https://discourse.julialang.org/t/how-to-pass-an-iobuffer-to-ccall/71547/1 "2021-11-16T11:02:04Z")

</div>

What is the correct way to interface with C for buffers (`IOStream`)? Can I just pass the file descriptor using `Base.fd`? (I don’t see any indications about this on either the `IOStream` or the `ccall` doc pages).

My example is even slightly more complicated than this: I am trying to write a wrapper for a C++ library in Julia, through a C interface. In particular, I need to wrap a C++ function which reads from a file (represented as a `std::istream` parameter). On the C++ side i can build the `std::istream` from a POSIX file descriptor (using boost). Will this cause problems with buffering?
