Web Hosting Talk







View Full Version : C/C++ UNIX System Calls


vivacity
12-01-2002, 05:06 AM
Hello,

By any chance does anyone know how to perform a system call (something that would be done at command line, such as "useradd" or "passwd") on a UNIX OS (RHLinux7.2, to be specific) in C or C++?

Thanks!

pickles
12-01-2002, 05:00 PM
system();

Try man system for more info.

Bob

vivacity
12-01-2002, 05:08 PM
wow. I feel stupid. Thanks! (new to c/c++ - I'd 100% use Java if it wasnt so much slower)

MarkIL
12-01-2002, 06:29 PM
Uhm, those two aren't syscalls. System calls are things like fcntl() or ioctl().

What you need is popen(3), system(3), exec(3), etc.
Refer to the documentation :)