Blitz (89/193)

From:Nick Clover
Date:15 Aug 2000 at 22:10:19
Subject:Re: Renaming files

Hello David

On 15-Aug-00, you wrote:

> Hi Tony
>
>> All I did was change
>> If NameFile(FileName$, FileName$+".Bkp")
>> to
>> If Rename_(FileName$, FileName$+".Bkp")
>>
>> and it's stopped working.
>
> I've always had problems passing temporary strings (i.e. ones that are
> made up on the fly during the function call) to OS functions. Its like the
> string gets lost somewhere. Try this:
>
> Fyle2$=FileName$+".Bkp"
> If Rename_(&FileName$, &Fyle2$)
> ...

Correct. According to the autodocs:

NAME
Rename -- Rename a directory or file

SYNOPSIS
success = Rename( oldName, newName )
D0 D1 D2

BOOL Rename(STRPTR, STRPTR)

FUNCTION
Rename() attempts to rename the file or directory specified as
'oldName' with the name 'newName'. If the file or directory
'newName' exists, Rename() fails and returns an error. Both
'oldName' and the 'newName' can contain a directory specification.
In this case, the file will be moved from one directory to another.

Note: it is impossible to Rename() a file from one volume to
another.

INPUTS
oldName - pointer to a null-terminated string
newName - pointer to a null-terminated string

RESULTS
success - boolean

SEE ALSO
Relabel()

If anyone wants a copy of C='s autodocs in guide format (purely for
reference and research purposes) they are on my website:

http://www.bauk.uksysops.com/download.html

Regards
Nick Clover

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie