Today I Learned: openat()
fopen and open
In C programming language, the <stdio.h>
header supplies functions for file input and output.
To open a file, we usually use the fopen function.
It is defined by the C language standard and works in every operating system.
Working at a lower level, there's also the open function. It is a system call provided by the Linux kernel and exposed through glibc.
Both fopen
and open
have an input parameter: the file pathname, as a NUL-terminated string.
These two functions are declared like this:
FILE* fopen(const char* filename, const char* mode);
int open(const char* pathname, int flags);