OSX equivalent of ShellExecute?

You can call system(); in any C++ application. On OSX, you can use the open command to launch things as if they were clicked on.

From the documentation for open:

The open command opens a file (or a directory or URL), just as if you had double-clicked the file’s icon. If no application name is specified, the default application as determined via LaunchServices is used to open the specified files.

All together, it would look like:

string command = "open " + filePath;
system(command.c_str());

Leave a Comment