Thread: How can i open a .exe file from my c++ program?

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    4

    Unhappy How can i open a .exe file from my c++ program?

    I am wondering how can i open a .exe file with my c++ program. Could some one give me the source code?

  2. #2

  3. #3
    Registered User
    Join Date
    Apr 2011
    Posts
    62
    just out of curiosity, how would I do something like this in non-windows operating systems?

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Same.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by killme View Post
    just out of curiosity, how would I do something like this in non-windows operating systems?
    I suggest reading this for other options under Linux.
    c - Difference between "system" and "exec" in Linux? - Stack Overflow

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  6. #6
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    964
    And a Windows specific alternative:

    ShellExecute function (Windows)
    How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.

  7. #7
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Of course it all depends on what you mean by opening an exe. One can open an exe for reading in the same way one opens a data file. A hes editor would do this, for example.

    Generally the terms such as "launch", "start" or "run" are used to indicate that you want the program to execute.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 06-20-2011, 12:36 PM
  2. How to open file from program's dir
    By Abda92 in forum C Programming
    Replies: 6
    Last Post: 07-29-2007, 10:23 PM
  3. Open file with program by default..
    By willc0de4food in forum Windows Programming
    Replies: 8
    Last Post: 09-18-2005, 03:50 PM
  4. change this program to open a file
    By A F Army in forum C Programming
    Replies: 3
    Last Post: 04-05-2003, 05:25 PM
  5. get program to open a html file
    By task in forum C Programming
    Replies: 14
    Last Post: 11-09-2001, 12:20 PM