Path: utzoo!attcan!uunet!cbmvax!ken From: ken@cbmvax.commodore.com (Ken Farinsky - CATS) Newsgroups: comp.sys.amiga.tech Subject: Re: CurrentDir Message-ID: <15072@cbmvax.commodore.com> Date: 11 Oct 90 14:05:20 GMT References: <1990Oct11.012013.24234@hoss.unl.edu> Reply-To: ken@cbmvax.commodore.com (Ken Farinsky - CATS) Organization: Commodore, West Chester, PA Lines: 29 In article <1990Oct11.012013.24234@hoss.unl.edu> 252u3130@fergvax.unl.edu writes: > I'm using Lattice 'C' and I'm changing the current directory in it. > Well, when the program quits, the SHELL path and the current directory > are off. I need to find out what the command is to read the name > of the current directory so I can chdir to it at the end of the program. This should do it. Randell will pipe in if I got it wrong... ;-) /* get a lock on the desired directory. */ if (0 != (lock = Lock(name,accessMode))) oldLock = CurrentDir(lock); /* change current dir */ /* run program given new current dir. ** the program will run here if it cannot get the lock, ** but it will be run from the (potentially) wrong dir. */ runProgram(); if (0 != lock) /* only change back and unlock if we got it. */ { CurrentDir(oldLock); /* change back to original dir */ UnLock(lock); } -- -- Ken Farinsky - CATS - (215) 431-9421 - Commodore Business Machines uucp: ken@cbmvax.commodore.com or ...{uunet,rutgers}!cbmvax!ken bix: kfarinsky