comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Advanced file manipulation (multiple question)
Date: Wed, 2 Mar 2005 19:12:41 -0800
Date: 2005-03-02T19:12:41-08:00	[thread overview]
Message-ID: <X_GdnfIyj7wHHbvfRVn-uA@comcast.com> (raw)
In-Reply-To: 74a78c42.0503020231.1dc804b6@posting.google.com

It sounds like you have downloaded Gnat 3.15p.
To make OS calls, you'll also want to get gnatwin-3.15p.exe
You can find it here:
  http://libre.act-europe.fr/GNAT/

gnatwin includes bindings to most of the Win32 API.

For example in the file win32-winbase.ads

You will find the binding for CopyFile.

   function CopyFile (lpExistingFileName : Win32.LPCSTR;
                      lpNewFileName : Win32.LPCSTR;
                      bFailIfExists : Win32.BOOL)
                     return Win32.BOOL
     renames CopyFileA; --  winbase.h :4919

It takes a little practice to get all of the right arguments set up with the 
right types to make these OS calls.  Fortunately you don't have to do it 
very often.

Steve
(The Duck)

"Steph-ADA" <france.suisse@gmail.com> wrote in message 
news:74a78c42.0503020231.1dc804b6@posting.google.com...
> Hello!
>
> Thanks for your helpful advices, and sorry for 1/my english,
> 2/abscence of details and 3/my error about Lady Lovelace name, Ada
> (and not ADA or anything else). I Hope this next post would be better
> :)
>
> So, first, my OS: Windows 2000 Pro. I use Gnat 3.15 (public).
> I started Ada as a student, with few advices and then... concurrent
> programming the next week (semaphore etc...), that was rather... hard,
> for beginners!
> So, my excuse if I don't know how call OS functions... maybe you have
> links where I can find tutorials about this ?
>
>> If you use Ada.Direct_Io, there is a nice way to read the file in one 
>> read,
>> but it takes two steps.
>>   First create an instance of Ada.Direct_Io of bytes.
>>   Open the file as bytes.
>>   Use the size function to get the size of the file.
>>   Close the file
>>   Create an instance of Ada.Direct_IO with an element that is the size of
>> the file (an array of bytes maybe?).
>>   Read the file (a single read)
>>   Close the file.
>
> This answer seems easier for me, and I'll add a "compare-file"
> procedure... I'm a bit paranoid :)
>
> Thanks a lot for your help
>
> Steph 





  reply	other threads:[~2005-03-03  3:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-01  9:30 Advanced file manipulation (multiple question) Steph-ADA
2005-03-01  9:59 ` Peter Hermann
2005-03-01 12:18 ` Larry Kilgallen
2005-03-01 17:49 ` Jeffrey Carter
2005-03-02  2:42 ` Steve
2005-03-02 10:31   ` Steph-ADA
2005-03-03  3:12     ` Steve [this message]
2005-03-02 16:56   ` Jeffrey Carter
2005-03-02 17:22     ` Larry Kilgallen
2005-03-03  0:26       ` Jeffrey Carter
2005-03-03  8:16         ` Martin Krischik
2005-03-04  9:20           ` Steph-ADA
2005-03-04 10:38             ` Jean-Pierre Rosen
2005-03-03  8:56         ` Steph-ADA
2005-03-03 19:36           ` Jeffrey Carter
2005-03-03 22:32           ` Randy Brukardt
2005-03-04  2:49           ` Steve
replies disabled

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