Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!kodak!ispd-newsserver!weimer From: weimer@ssd.kodak.com (Gary Weimer) Newsgroups: comp.unix.questions Subject: Re: mv'ing files from a C program Message-ID: <1990Nov15.160629.3739@ssd.kodak.com> Date: 15 Nov 90 16:06:29 GMT References: <22@mixcom.UUCP> Sender: news@ssd.kodak.com Distribution: na Organization: Eastman Kodak Lines: 10 In article <22@mixcom.UUCP> ggvvgg@mixcom.UUCP (Dave Fenske) writes: >Is there an easy way to do an 'mv' from a C program? > >I just want to be able to move a recently read file into another directory, >and wish to avoid having to write it there. Using the 'system' call is >not deemed wiable for this application. > You could simulate the mv command using link(2) and unlink(2). First create a second link in the new directory. If no error, remove first link (unlink).