Question

How would I wrap a function that accepts an argument of type FILE using FFI in Ruby?

int fprintf ( FILE * stream, const char * format, ... );
Was it helpful?

Solution

It's not type FILE, but FILE *. Just another :pointer like any other.

If you need to build a struct to examine the contents of the memory pointed to, you need to find the definition of FILE in your system's stdio.h and reproduce it as an FFI struct.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top