Re: system() function
- From: "Lew Pitcher" <lpitcher@xxxxxxxxxxxx>
- Date: 21 Mar 2007 10:08:50 -0700
On Mar 21, 12:29 pm, "gio" <giorginooo.ro...@xxxxxxxx> wrote:
Thank you Josef.
This garant me that after the system() the current working directory
is X again?
The cwd of your process (the one that called system()) never changed
from where-ever it was before it called system(). On Linux (and all
unixish systems) system() forks a secondary process tree (sh, your-
called-command) and it is /that/ tree that changes cwd. Your process
(running separately from that tree) is independent of that tree, and
does not change cwd.
Also in Windows?
Nope. The formatting presented by Josef is only guaranteed for systems
that implement a forked system() call, and use a Posix shell. In other
words, Unixish systems only. In Windows, you have to find a different
way to do this (I don't think that the compound statement will work in
the Windows implementation of system() ).
HTH
--
Lew
.
- Follow-Ups:
- Re: system() function
- From: jasen
- Re: system() function
- References:
- system() function
- From: gio
- Re: system() function
- From: Josef Moellers
- Re: system() function
- From: gio
- system() function
- Prev by Date: Re: system() function
- Next by Date: Re: daemon caching weird exit status from a shell script
- Previous by thread: Re: system() function
- Next by thread: Re: system() function
- Index(es):