'Rename' Library Function?
Jonathan Bayer
jbayer at ispi.UUCP
Tue Sep 19 23:00:43 AEST 1989
dave at 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 at ispi.COM Roselle Park, NJ 07204
More information about the Comp.unix.xenix
mailing list