Is there any way to open a windows file or program through C++?
Is there any way to open a windows file or program through C++?
Yes. You can use the system() command.
It can be a security issue if it's used incorrectly though. For instance, don't let users input whatever they want into a string that is presumable a file they're supposed to open and just throw that into the system command.Code:system("notepad");
Sent from my iPadŽ
ok thanx
There are other options like ShellExecute or CreateProcess. There is a FAQ entry on running other programs I believe.
start automatically opens a document with the default program (like ShellExecute). ie:
will open hello.c with whatever your IDE for .c files is.Code:system("start hello.c");
[edit]
FAQ entry: http://faq.cprogramming.com/cgi-bin/...&id=1043284392
[/edit]
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.