OSX equivalent of ShellExecute?

前端 未结 3 1736
北荒
北荒 2020-12-06 12:09

I\'ve got a C++ app that I\'m porting from Win32 to OSX. I\'d like to be able to launch arbitrary files as if the user opened them. This is easy on windows using ShellExec

3条回答
  •  情深已故
    2020-12-06 12:18

    You can simply use the system(); function. For example, say you wanted to put your dock into the corner of the screen.

    You can simply put:

    system(defaults write com.apple.dock pinning -string end);
    sleep(1f);
    system(killall Dock);
    

    It's that easy. Hope I helped :)

提交回复
热议问题