comp.lang.ada
 help / color / mirror / Atom feed
From: "DuckE" <nospam_steved94@home.com>
Subject: Re: How to rename a file?
Date: Fri, 28 Sep 2001 02:16:24 GMT
Date: 2001-09-28T02:16:24+00:00	[thread overview]
Message-ID: <Y3Rs7.46826$QK.32812951@news1.sttln1.wa.home.com> (raw)
In-Reply-To: MYKs7.11405$%r.2963162@news20.bellglobal.com

Here's how I make the OS call on WindowsNT/W2K using ObjectAda or GNAT:

WITH Win32;
WITH Win32.WinBase;
WITH Interfaces.C;
 ...
  PACKAGE WinBase RENAMES Win32.WinBase;
  PACKAGE C RENAMES Interfaces.C;

  USE TYPE Win32.BOOL;
  USE TYPE Win32.DWORD;
...
  PROCEDURE RenameFileDFU( sourceFileNameDFU, destFileNameDFU : STRING;
                           renamedDFU : out BOOLEAN ) IS
    result     : Win32.BOOL;
    sourceName : ALIASED C.Char_Array := C.To_C( sourceFileNameDFU );
    destName   : ALIASED C.Char_Array := C.To_C( destFileNameDFU );
  BEGIN
    result := WinBase.MoveFile( sourceName(0)'UNCHECKED_ACCESS,
                                destName(0)'UNCHECKED_ACCESS );
    renamedDFU := result /= Win32.FALSE;
  END RenameFileDFU;

I hope this helps,
SteveD

"Pi" <pi3_1415926536@yahoo.ca> wrote in message
news:MYKs7.11405$%r.2963162@news20.bellglobal.com...
> It may sound stupid, but I didn't find anything.
>
> Is there a way to rename files in Ada?
>
> Other than :
> create a new file,
> copy every byte into the new one,
> delete the old one.
>
> --
> 3,14159265359
>





  parent reply	other threads:[~2001-09-28  2:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-27 19:43 How to rename a file? Pi
2001-09-27 23:09 ` tmoran
2001-09-27 23:36   ` Larry Kilgallen
2001-09-28  2:16 ` DuckE [this message]
2001-09-28  2:54   ` Pi
2001-09-28  3:41   ` David Botton
2001-09-28  7:39     ` Lutz Donnerhacke
2001-09-28 17:34     ` Pascal Obry
2001-09-28 18:39       ` Larry Kilgallen
2001-09-30  1:51       ` David Botton
2001-09-30  8:53         ` Pascal Obry
2001-09-30 10:21           ` Florian Weimer
2001-09-30 14:53             ` Pascal Obry
2001-09-29  5:02     ` DuckE
2001-09-28  3:16 ` David Botton
2001-09-28 16:03   ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox