Re: system() function



On 2007-03-21, Lew Pitcher <lpitcher@xxxxxxxxxxxx> wrote:
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() ).

if you use '&' instead of ';' it'll work in windows (NT or better)


Bye.
Jasen
.



Relevant Pages

  • Re: system() function
    ... The cwd of your process ) never changed ... unixish systems) systemforks a secondary process tree (sh, ... called-command) and it is /that/ tree that changes cwd. ... the Windows implementation of system). ...
    (comp.os.linux.development.apps)
  • OT: The Hangmans Tree - Chapter One - A Brief Introduction
    ... "Walnut Hill" came to our township at the cost of one dollar and the ... The house was a ramshackle pile that had sat empty for more than ... I called him to do the tree survey that was mandated prior to ... windows on either side of a large door on the first floor front ...
    (rec.woodworking)
  • Re: The Hangmans Tree - Chapter One - A Brief Introduction
    ... "Walnut Hill" came to our township at the cost of one dollar and the ... The house was a ramshackle pile that had sat empty for more than ... I called him to do the tree survey that was mandated prior to ... windows on either side of a large door on the first floor front ...
    (rec.woodworking)
  • Numerous issues with insurance claim - any advice?
    ... After I submitted names, addresses and phone numbers of the tree owners to the engineering company they did nothing for 4 weeks - not even send a letter requesting the owners remove the tree, although their own report says it needed to be done quickly. ... After the claim had begun, but before any remedial work under this claim started taking place, my wife and I decided to have new PVC windows installed. ... with each being covered in flicks of paint from their rollers - they did not bother covering the windows. ...
    (uk.legal)
  • Re: Common Windows XP Shutdown problem
    ... | Navigate on the left side tree to the HKEY_CURRENT_USER folder ... I'm not using the Spanish version of Windows XP. ...
    (microsoft.public.windowsxp.general)