I'm playing around with mkstemp()
, which provides a file descriptor, but I want to generate formatted output via fprintf()
. Is there an easy way to transform the file descriptor provided by mkstemp()
into a FILE *
structure that is suitable for use with fprintf()
?
Use fdopen()
:
FILE* fp = fdopen(fd, "w");