Looking at the man page for fopen I cannot get a definite answer to this question.
FILE *fopen(const char *path, const char *mode);
I understand that fopen returns a file pointer to a stream but is a file descriptor created as a byproduct? I am trying to make sure that I include the flag FD_CLOEXEC on every instance a file descriptor is created. If a file descriptor is in fact created from fopen what is the best way to use fcntl() when there is no "fd" to use as input.
On Unix (which I assume you’re using because you’re mentioning
fcntl) it does open a file descriptor, asfopen(3)eventually callsopen(2).You can get that file descriptor viafileno(3).