Using System Calls in C++
System calls can be dangerous and it is strongly advisable not to use them whenever possible.
Certain system calls can be made safely with the use of the <sys/stat.h>
header, which wraps the underlying functionality in a library such that bad actors cannot use the system call to compromise your program or system.
ADDITIONAL RESOURCES