What kind of julia object translates to C's FILE*

I’m on Julia 1.6.5 and trying to redirect verbose messages from LibCURL to a file. In C this would be done by calling curl_easy_setopt(CURL *handle, CURLOPT_STDERR, FILE *stream).

What kind of a Julia object should I pass in as FILE *stream? Ideally I’d be able to use either a file or an in-memory IOStream.

Note that I don’t want to capture all of stderr (eg: using redirect_stderr), I just need to capture curl's verbose output while allowing all other stderr output to keep going to stderr.

A Libc.FILE object, which you can create from an io::IO object (such as a file or a pipe) by f = Libc.FILE(io). (I think you have to manually call close(f) when you are done with it, because the constructor duplicates the file descriptor (julia#10535)?)

See also How to create Libc.FILE from a string, Access C stdout in Julia, and Libc.FILE for stdout

Ah, I think I was missing the close so it was probably not getting flushed.