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.
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.
Last edited by SlyMaelstrom; 07-03-2006 at 08:21 AM.
Sent from my iPadŽ
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=1043284392I also don't know about Linux.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.