Path: utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!ispi!jbayer From: jbayer@ispi.UUCP (Jonathan Bayer) Newsgroups: comp.unix.xenix Subject: Re: 'Rename' Library Function? Keywords: rename lib Message-ID: <1167@ispi.UUCP> Date: 19 Sep 89 13:00:43 GMT References: <[157]unix@oldcolo.UUCP> Organization: Intelligent Software Products, Inc. Lines: 36 dave@oldcolo.UUCP (Dave Hughes) writes: >WHen I try to compile an indexing program written on a Mac (AIX I think) >system, which has a 'rename' library function, it bombs on that function, >returning an 'unresolved external' error on _rename. >It is used - and needed - in the following type of use: > char oldname[32], finalname[65]; > sprintf (oldname, "x%dk0", generation_number); > sprintf (finalname, "%s.k", doc_filename); > if (rename (oldname, finalname)) > printf ("Sorry -- error in renaming file %s to %s!\n", oldname, > finalname); >I cannot find another 386 Xenix compiler library function which will >work in its place. Any suggestions? Use the following: if ( (z = link (oldname, newname)) == 0) { z = unlink (oldname); if (z) printf ("Sorry -- error in renaming file %s to %s!\n", oldname, finalname); printf ("error: %d\n",errno); JB -- Jonathan Bayer Intelligent Software Products, Inc. (201) 245-5922 500 Oakwood Ave. jbayer@ispi.COM Roselle Park, NJ 07204