Results 1 to 5 of 5

Thread: Local folder problem

  1. #1
    Senior Member
    Join Date
    Oct 2003
    Posts
    394

    Local folder problem

    I programming in c++ and I need help.

    I made one program that should run other program, but i got one problem
    Program unable to run program if it running directly from other folder.
    t.ex.

    program located in folder
    c:\windows\progs\myprog.exe

    I starting it in command line from root C:\

    and program showing that path not found

    but when i opening c:\windows\progs\ and then running program, so it works.

    ....
    how can I make program to find folder that it was running from. (programs local folder and run other program from this folder)
    // too far away outside of limit

  2. #2
    Senior Member
    Join Date
    Apr 2004
    Posts
    1,130
    2 ideas:

    a) add called program' path to PATH
    b) call "called program" using absolute path (full path). Windows is good but isnt magic; it cant find a program in you disk if you dont give it some tips
    Meu sítio

    FORMAT C: Yes ...Yes??? ...Nooooo!!! ^C ^C ^C ^C ^C
    If I die before I sleep, I pray the Lord my soul to encrypt.
    If I die before I wake, I pray the Lord my soul to brake.

  3. #3
    Senior Member
    Join Date
    Oct 2003
    Posts
    394
    How can I make my program to identify what folder it was runing from?
    // too far away outside of limit

  4. #4
    Senior Member
    Join Date
    Oct 2003
    Posts
    394
    I using stdlib.h and system() to run other programs, but do some one know some other way to do it?
    // too far away outside of limit

  5. #5
    CreateProcess
    to start one, also other process API's are on this site,
    and GetCwd to get the current working directory.

    hope this helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •