How can i execute an external file without know program location?
Example, i will execute a document but i don't know if ms word is installed.
Thanks and excuse me for my bad english. :(
Printable View
How can i execute an external file without know program location?
Example, i will execute a document but i don't know if ms word is installed.
Thanks and excuse me for my bad english. :(
You shouldn't have to worry about that. Operating Systems like Windows have default applications to open specific file types so you don't have to look for them. You only have to pass the file to the shell and let it do the rest. I'd say look into ShellExecute() in <windows.h> as I think that's C. It might be C++, though. Actually, I guess it has to be C because <windows.h> is all C.
I also don't know about Linux. They might not have defaults, in which case I have no current answer for you.
I tried with ShellExecute like following
ShellExecute(0,"open","C:\\temp.doc","","",SW_SHOW MAXIMIZED);
..and works!!
Thank you :)
http://faq.cprogramming.com/cgi-bin/...&id=1043284392Quote:
I also don't know about Linux.