I'm trying to use the chdir() and/or setcurrentdir() functions but they
aren't reflecting the change in the console (dos prompt). The application
thinks it's changed directories but it's not physically reflected in the
window.
Is there something else that might provide this? Am I missing something? I
thought this seemed fairly straight forward but it's not behaving like I
thought it should.
Any suggestions are appreciated.
Thanks,
Tod Jackson
jack...@uillinois.edu
This is where you learn that Win32 isn't Dos-based. Each Win32 app runs in a
separate process, with its separate dir settings, among other things. When
you launch a console app from a console, you are launching a new process,
from an existing one, both happening to use a console user interface. You
can easily show that your chDir or setCurrentDir *are* successful, within
your console app. They just have no effect at all on the calling process.
Dos apps, by contrast, all ran *and still run* in the same process, the
console process they're launched from. I have BP7, and my workaround for
your problem is to do this in BP7 -- where it works perfectly. However, I
have no idea how to do it from a console app, and my current opinion is that
its not possible -- you can't get another process's directory changed
without that process's collaboration.
There might be a trick to feed the directory string back to a batch file
from which your app would be called, but I don't know how to do it.
PhR
Thanks again.
TJ
Philippe Ranger <.> wrote in message news:7hv3n3$et...@forums.borland.com...
It will not work, Tod. In Win32 the "current directory" is a purely
process-local concept. A process cannot change the current directory for its
parent process, only for child processes it spawns (via ShellExecute or
CreateProcess).
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
> <<Tod:
> I'm trying to use the chdir() and/or setcurrentdir() functions but they
> aren't reflecting the change in the console (dos prompt).
> >>
> There might be a trick to feed the directory string back to a batch file
> from which your app would be called, but I don't know how to do it.
>
> PhR
Using a batch file is how I got my Directory Maven 95 program
(http://www.briggsoft.com/dm95.htm) to change directories with a console app.
--
Kent Briggs, kbr...@briggsoft.com
Briggs Softworks, http://www.briggsoft.com