Reputation: 10109
There is fileno
to get the file descriptor of a FILE*.
How do you get the address for the FILE* given a file descriptor number, e.g. as returned from pipe
?
Upvotes: 2
Views: 919
Reputation: 61540
You want to use the fdopen()
function:
FILE * file = fdopen(fd, "r");
so you could use it in combination with pipe
like this:
FILE * file = fdopen(pipe(..,..), "r");
Upvotes: 3