Search code examples
c++execute

Open file with another application


Hy!

I want to open an .xml file from c++ with a specified application (knowing the path of the file and the path of the application). Same way as you would right-click the file and click "Open with..." and choose the application to start with.

Thanks in advance!


Solution

  • Usually applications allow command line arguments for file opening. For example, to open a file with notepad you can use command line :

    notepad.exe a.txt
    

    That's why you can use this feature with CreateProcess in Windows (which allows specifying arguments) or analogous function in other OS . HTH