comp.lang.ada
 help / color / mirror / Atom feed
From: "Martin Dowie" <martin.dowie@nospam.baesystems.com>
Subject: Win32 filetype problem
Date: Fri, 14 Sep 2001 10:57:02 +0100
Date: 2001-09-14T10:57:02+01:00	[thread overview]
Message-ID: <3ba1d1b9$1@pull.gecm.com> (raw)

System: WIntel NT, GNAT 3.13p

I don't seem to be able to determine if a filename (specified in
an Ada string) is a directory or not using the Win32 bindings in
GNAT.

I've been through the help file but there is nothing that answer
what is happening.

Here's a code snip of what I have:

declare
   function To_LPCSTR is
      new Ada.Unchecked_Conversion (Source => System.Address,
                                    Target => Win32.LPCSTR);
   C_Filename : Chars_Ptr := New_String (Trimmed_Filename);
   Result : Win32.DWORD;
begin
   Result := Win32.Winbase.GetFileAttributesA (lpFileName => To_LPCSTR (S =>
C_Filename'Address));
   Ada.Text_IO.Put_Line ("oops? " & Boolean'Image (Result =
6#FFFF_FFFF#));  -- always displays "oops? TRUE"
   return Result /= 16#FFFF_FFFF# and then
          (Result and Win32.WinNT.FILE_ATTRIBUTE_DIRECTORY) =
Win32.WinNT.FILE_ATTRIBUTE_DIRECTORY;
end;

--
Kernighan and Ritchie : "C was designed on the assumption
                         that the programmer is someone
                         sensible who knows what he's
                         doing"
Ada Reference Manual : "Ada was designed with the
                        concern of programming as a
                        human activity"







             reply	other threads:[~2001-09-14  9:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-14  9:57 Martin Dowie [this message]
2001-09-14 10:17 ` Win32 filetype problem Martin Dowie
  -- strict thread matches above, loose matches on Subject: below --
2001-09-14 16:19 Beard, Frank
2001-09-14 18:34 ` martin.m.dowie
2001-09-15  9:16   ` Pascal Obry
     [not found] <B6A1A9B09E52D31183ED00A0C9E0888C469C65@nctswashxchg.nctswash.navy.mil>
2001-09-16  4:11 ` David Botton
2001-09-16  7:44   ` Pascal Obry
replies disabled

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