This is your fourth question on this exact problem and you have been given all the available suggestions. It is now time to start putting all the information together. And as you should be aware, system commands do not always have a direct C/C++ function that can be used. Specific details of each command, and links to callable functions, can be found in the man pages.
See also Ubuntu Manpage: syscalls - Linux system calls