Thread: Opening program code

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    2

    Opening program code

    Does anyone know the code to open another program in dos?

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Call system() and pass the name (including the path) of your other program, eg:

    system ("c:\\testprogram.exe");
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Banned
    Join Date
    Jun 2005
    Posts
    594
    System not always a good option :

    There a great post here on doing this very thing :

    FAQ

  4. #4
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I had a feeling it wasn't. To tell the truth I've never really opened a program from a program system() just popped into my head. Maybe I shouldn't have answered...
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  5. #5
    Banned
    Join Date
    Jun 2005
    Posts
    594
    it not that bad in some cases, anyways i forgot to include
    the usual dumb remark, so here it goes.


    Did you really want to know how to open a program through
    dos, or did you mean a command prompt, because they
    are 2 different things?

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Does anyone know the code to open another program in dos?
    I think he means from inside another program.
    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.

  7. #7
    Banned
    Join Date
    Jun 2005
    Posts
    594
    yea i know that i was just being a a$$ lol
    id already answered his question anyways.

  8. #8
    Registered User
    Join Date
    Jul 2005
    Posts
    2
    I meant if i make a index program like if you input 1 then open this *.exe

  9. #9
    Banned
    Join Date
    Jun 2005
    Posts
    594
    what you should do is have a file
    where the user can add the path to
    any programs he wants then simply
    read them in display them
    let the user pick which one to run
    then you can run it

  10. #10
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    the best way is to not rely on outside programs unless you have a way to verify that they are/are doing what you want/need them to be doing...

    for examle, system(...) just basically sends a request to the OS. it's the same as typing directly on the command line. but that becomes a problem when something's not right. what happens when somebody moves notepad, or worse, replaces it with a malicious bit of code?

    ILoveVectors was right about the difference between DOS and the command prompt, and it is a very valid point--don't get them confused. DOS is an old operating system, that is no longer included with newer windows operating systems.

    for example, in windows 95, you can use DOS. in Windows XP, there is no DOS to use. when you bring up a command prompt and type in 'notepad.exe', it's pretty much the same as going through the start menu and clicking on notepad...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to make a program that prints it's own source code???
    By chottachatri in forum C++ Programming
    Replies: 38
    Last Post: 03-28-2008, 07:06 PM
  2. Need help on code to execute the program
    By hibmem10 in forum C++ Programming
    Replies: 6
    Last Post: 12-24-2005, 01:42 PM
  3. grade program code
    By jd7joe in forum C++ Programming
    Replies: 8
    Last Post: 11-18-2005, 04:48 PM
  4. how do I morse code converting program
    By panfilero in forum C Programming
    Replies: 17
    Last Post: 10-29-2005, 09:16 PM
  5. Replies: 5
    Last Post: 04-17-2003, 07:07 AM