Article View: comp.sys.amiga.tech
Article #5821Re: CurrentDir
From: Ken Farinsky - CATS
Date: Thu, 11 Oct 1990 14:05
Date: Thu, 11 Oct 1990 14:05
29 lines
1479 bytes
1479 bytes
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
Technical Details
Message-ID:
<15072@cbmvax.commodore.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cbmvax!kenReferences:
<1990Oct11.012013.24234@hoss.unl.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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