Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uxc!tank!shamash!com50!dayton!joe From: joe@dayton.UUCP (Joseph P. Larson) Newsgroups: comp.sys.amiga.tech Subject: getcwd() and chdir() functions Message-ID: <6481@dayton.UUCP> Date: 1 Apr 89 16:52:15 GMT Reply-To: joe@dayton.UUCP (Joseph P. Larson) Distribution: usa Organization: Dayton-Hudson Dept. Store Co. Lines: 43 What is the *proper* way to perform an change-working-directory from C? Ditto a get-working-directory? (That is "cd place" and "cd" from the CLI.) As per Rob Peck's book, I did the following for the getcwd() -- me = FindTask(0); success = Examine(me->pr_CurrentDir, &fib); printf("Current directory: %s\n", fib.fib_FileName); However, this doesn't include the disk name. Arg. -- As for the chdir() -- if (i created an earlier directory lock) UnLock(oldlock); myLock = Lock(dname, ACCESS_READ); dummyreturn = ChangeDir(myLock); Rob's book indicates I shouldn't unlock any lock I didn't create. But doesn't this leave a lock on the old directory sitting around? Shouldn't I just do this: myLock = Lock(dname, ACCESS_READ); oldlock = ChangeDir(myLock); if (oldlock != NULL) UnLock(oldlock); But Rob's book says this'll piss off DOS. -- Am I going about all this the hard way? I'm using Manx and couldn't find equivalent routines in their library, but it *was* late and dark and.... -Joe -- Life is a cabaret (old chum). UUCP: rutgers!dayton!joe (Picts 1-13 are DHDSC - Joe Larson/MIS 1060 ATT : (612) 375-3537 now ready.) 700 on the Mall, Mpls, Mn. 55402