Is there any way to change an int
file descriptor to a FILE
struct pointer or/and change FILE*
to a file descriptor in C?
The normal return value from open is a non-negative integer file descriptor. In the case of an error, a value of -1 is returned instead. In addition to the usual file name errors (see File Name Errors), the following errno error conditions are defined for this function: EACCES.
The lseek call is used to modify the file offset associated with the descriptor fd.
The function fdopen()
returns a new (FILE *) associated with an open file descriptor.
The function fileno()
returns the file descriptor associated with an open FILE *.
Use "fileno()" for FILE->int.
Use "fdopen()" for int->FILE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With