开发者

What is an operating system independent way to open file with associated program from C++?

开发者 https://www.devze.com 2023-02-18 05:18 出处:网络
What is an operating system independent way to open a file with associated program from C++? Is there a solution in Boost, or something like it?

What is an operating system independent way to open a file with associated program from C++? Is there a solution in Boost, or something like it?

More specifically, something that would cover Windows, Mac OS X, and Linux.

What I am trying to do is o开发者_JS百科pen a file ending in the .txt extension in the program that the user already has set up to open it if they were to open it themselves via clicking it or command line.

The mechanism needs to be asynchronous.


QDesktopServices::openUrl from Qt library provides this. It is asynchronous (non-blocking).


Just calling the name of the data file with system() should work on any OS that supports typing the filename on the command line

0

精彩评论

暂无评论...
验证码 换一张
取 消