468,289 Members | 1,893 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,289 developers. It's quick & easy.

Opening file in c++

sam
Sir,

I just wanted to know how i will opened file (any exe or other
type file )in c++ and run it.
and how we will give path when we are opening it.
please give me the code of this small program.
thanks in advance
Sep 11 '08 #1
2 1511
On 2008-09-11 14:44, sam wrote:
Sir,

I just wanted to know how i will opened file (any exe or other
type file )in c++ and run it.
and how we will give path when we are opening it.
please give me the code of this small program.
You can use system() to run another program, but I would strongly
discourage its use. There are other ways to execute another program but
they are all platform dependent, but many platforms are more or less
POSIX compatible and supports exec() and friends.

--
Erik Wikström
Sep 11 '08 #2
sam <sa*******@gmail.comwrote:
>Sir,

I just wanted to know how i will opened file (any exe or other
type file )in c++ and run it.
and how we will give path when we are opening it.
please give me the code of this small program.
That depends on what operating system you're using. Linux/Unix would
use a "fork" call, Windows programs would use something in the Win32
API. You should ask in a platform-specific group (or consult your
system documentation), it's off-topic here.

--
Tim Slattery
Sl********@bls.gov
http://members.cox.net/slatteryt
Sep 11 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.