I would like to have a FILE* type to use fprintf.
I need to use fdopen to get a FILE* instead of open that returns an int.
But can we do the same with fdopen and open? (I never used fdopen)
I would like to do a fdopen that does the same as :
open("my_file", 0_CREAT | O_RDWR | O_TRUNC, 0644);
fdopentakes a file descriptor that could be previously returned byopen, so that is not a problem.Just
openyour file getting the descriptor, and thenfdopenthat descriptor.fdopensimply creates a userspace-buffered stream, taking any kind of descriptor that supports thereadandwriteoperations.