home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
Amiga
/
Workbench
/
Archivers
/
arcPPC.lha
/
arcPPC
/
srcpup.lha
/
srcpup
/
rename.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-04-08
|
614b
|
44 lines
/* by Andreas R. Kleinert in 1998 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dos/dosextens.h>
#include <proto/dos.h>
int rename(const char *old, const char *new) /* including move(), thus across devices */
{
int res;
res = Rename(old, new);
if(!res)
{
FILE *src, *dst;
int c;
res = FALSE;
src = fopen(old, "rb");
if(src)
{
dst = fopen(new, "wb");
if(dst)
{
while( (c = fgetc(src)) != EOF) fputc(c, dst);
res = TRUE;
fclose(dst);
}
fclose(src);
if(res) DeleteFile(old);
}
}
return(!res);
}