Hello,
I'm learning C++ and i want to know how i can build a program written in C++ that can execute other programs, like firefox.

Thanks,
Nathan Paulino Canpos

Recommended Answers

All 6 Replies

In unix it is execv ,etc , you do not need to launch firefox to send data from a website.

Thanks for all, but i learned myself, for those who needs here is it:

#include <stdlib.h>
#include <stdio.h>
using namespace std;

int main( int argc, char *argv[] )
{
    (void)system( "gedit" );
  return(0);
}

Thanks!

You don't need to cast your call.

You should be extremely wary of ever using system(), in fact it should just be avoided. Else risk being ridiculed or angry e-mails when something goes wrong.

Why did you use the std:: namespace if you're just using C headers, and no STL?

Agree with MosaicFuneral, it is recommended to use ShellExecute() if you're in Windows.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.