From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1149539ccb97b04c,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-14 02:58:06 PST From: "Martin Dowie" Newsgroups: comp.lang.ada Subject: Win32 filetype problem Date: Fri, 14 Sep 2001 10:57:02 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: ed125012.sd.edinbr.gmav.gecm.com Message-ID: <3ba1d1b9$1@pull.gecm.com> X-Trace: 14 Sep 2001 10:45:29 GMT, ed125012.sd.edinbr.gmav.gecm.com Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!demon!btnet-peer0!btnet-feed3!btnet!newreader.ukcore.bt.net!pull.gecm.com!ed125012.sd.edinbr.gmav.gecm.com Xref: archiver1.google.com comp.lang.ada:13072 Date: 2001-09-14T10:57:02+01:00 List-Id: 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"