How can I execute a system command in c++

S

silverburgh.meryl

Hi,

I am writing a C++ program under linux.
Can you please tell me how can I execute a System command in c++?
Kind of like System.exec() in Java?

Thank you.
 
J

John Harrison

Hi,

I am writing a C++ program under linux.
Can you please tell me how can I execute a System command in c++?
Kind of like System.exec() in Java?

Thank you.

#include <stdlib.h>

system("your command here ");

'kind of' like System.exec() is the right way to describe it. Linux has
O/S functions like exec and fork, which might be more appropriate, but
these are not standard C++.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top