fopen(3) is returning a FILE*
on success, but open(2) is returning a file descriptor on success, so they are not doing the same (since not giving the same type).
However, on Linux, fopen
is internally using the open
system call (and some others too...).
<stdio.h>
file handles are handling buffering. With system calls like open
and read
you'll better do your own buffering.
See also this & that and read Advanced Linux Programming & syscalls(2). Be aware that on Linux, from the user-land application point of view, a system call is essentially an atomic elementary operation (e.g. the SYSCALL
or SYSENTER
machine instruction).
Use strace(1) to find out which system calls are executed (by a given process or command).
On Linux, the libc is implementing standard functions (like fprintf
....) above system calls.
Many system calls don't have any libc counterpart (except their wrapper), e.g. poll(2)