Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!thyme!kaleb From: kaleb@thyme.jpl.nasa.gov (Kaleb Keithley ) Newsgroups: comp.unix.questions Subject: Re: mv'ing files from a C program Message-ID: <1990Nov15.192748.3952@thyme.jpl.nasa.gov> Date: 15 Nov 90 19:27:48 GMT References: <22@mixcom.UUCP> <1990Nov15.132952.11932@virtech.uucp> <1990Nov15.183359.963@ssd.kodak.com> Distribution: na Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 22 In article <1990Nov15.183359.963@ssd.kodak.com> weimer@ssd.kodak.com (Gary Weimer) writes: >In article <1990Nov15.132952.11932@virtech.uucp> cpcahil@virtech.UUCP (Conor P. Cahill) writes: >>You don't have to use system(3), you can use fork/execl(2) (or one of it's >>family of functions) as follows: >> >> if( fork() == 0 ) >> execl("/bin/mv","mv",oldfile,newfile,(char *)0); >> else >> wait((int *)0); > >That's just about exactly what system(3) does. (i.e. you gain nothing for >all the added code) Both seem kind of expensive. What's wrong with rename.... (man 2 rename). Since I jumped into the middle of this, I presume you're talking about the same file system, which is a limitation on rename. -- Kaleb Keithley Jet Propulsion Labs kaleb@thyme.jpl.nasa.gov I don't watch Twin Peaks; I just come to work.