A file descriptor is just an integer which you get from the POSIX open() call. Using the standard C fopen() you get a FILE struct back. The FILE struct contains this file descriptor amongst other things such as end-of-file and error indicator, stream position etc.
How do I find file descriptor?
Get the file descriptor from a FILE pointer (e.g. file ) in C on Linux: int fd = fileno(file); More details can be found in the man page of fileno : fileno manual .
Is file descriptor a pointer?
A file descriptor is a low-level integer "handle" used to identify an opened file (or socket, or whatever) at the kernel level, in Linux and other Unix-like systems. ... A FILE pointer is a C standard library-level construct, used to represent a file.