exes in other directories

This is a discussion on exes in other directories within the C++ Programming forums, part of the General Programming Boards category; i know i know, how to run a exe from inside a program is in the faq but i need ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    24

    exes in other directories

    i know i know, how to run a exe from inside a program is in the faq but i need to know how to run one that is in a different directory than the one the program is running in. Im using the system() commad.
    (please help)

    Skeptic

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    This probally involves adding something to your path, so that the system knows where else to look.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    24
    well i tried things like

    system("c:\mydir\myprogram.exe")

    but it didnt work

  4. #4
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Code:
    system("Dir1/Dir2/myfile.dat");
    or if its a few directories back,

    Code:
    system("..\..\dir1\myfile.dat");

    I think you can do it that way

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    24
    i should change my name to stupid, i had the wrong slashes.

  6. #6
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Wha? That has never mattered for me.....
    Maybe i have never tried them both =)

  7. #7
    Registered User
    Join Date
    Nov 2001
    Posts
    24
    is there a way to call two programs at the same time, with out waiting for the first one to close?

  8. #8
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    \ signals an escape sequence \n, \a, \t, \", etc. In order to produce a \ you'd use \\.
    So:

    system( "C:\\filename" );
    If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?

  9. #9
    Registered User
    Join Date
    Nov 2001
    Posts
    24
    \\ doesnt seem to work the program still waits till the first is closed then runs the second

  10. #10
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    If you're trying to run two programs then you need to look into multi-threading. Using the system call won't cut it.
    If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. VC6 directories
    By Magos in forum Tech Board
    Replies: 0
    Last Post: 03-11-2005, 04:52 PM
  2. question about standard directories and file types
    By FillYourBrain in forum Linux Programming
    Replies: 9
    Last Post: 10-09-2003, 09:57 PM
  3. mkdir and multiple directories
    By Idle in forum C Programming
    Replies: 4
    Last Post: 06-28-2003, 04:56 AM
  4. EXEs too big
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 07-07-2002, 11:34 AM
  5. Working with directories...
    By C Seņor in forum C Programming
    Replies: 4
    Last Post: 04-20-2002, 11:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21