Opening file in c++

Discussion in 'C++' started by sam, Sep 11, 2008.

  1. sam

    sam Guest

    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
    sam, Sep 11, 2008
    #1
    1. Advertising

  2. sam

    Tim Slattery Guest

    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.


    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

    http://members.cox.net/slatteryt
    Tim Slattery, Sep 11, 2008
    #2
    1. Advertising

  3. 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
    Erik Wikström, Sep 11, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ben
    Replies:
    10
    Views:
    4,943
    Old Wolf
    Feb 25, 2004
  2. Replies:
    7
    Views:
    497
  3. amacch95

    opening media file in asp file

    amacch95, Apr 17, 2008, in forum: .NET
    Replies:
    0
    Views:
    335
    amacch95
    Apr 17, 2008
  4. fniles
    Replies:
    0
    Views:
    268
    fniles
    Apr 26, 2009
  5. John Smith
    Replies:
    2
    Views:
    293
    Brian McCauley
    Dec 1, 2003
Loading...

Share This Page