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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,660973a335e8cfa0,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news.glorb.com!uio.no!newsfeed1.funet.fi!newsfeeds.funet.fi!nntp.inet.fi!central1.inet.fi!inet.fi!read3.inet.fi.POSTED!53ab2750!not-for-mail Sender: AWI003@FIW9430 Newsgroups: comp.lang.ada Subject: File list on Windows and Debian From: Anders Wirzenius Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 19 Jun 2006 08:09:51 GMT NNTP-Posting-Host: 194.251.142.2 X-Complaints-To: abuse@inet.fi X-Trace: read3.inet.fi 1150704591 194.251.142.2 (Mon, 19 Jun 2006 11:09:51 EEST) NNTP-Posting-Date: Mon, 19 Jun 2006 11:09:51 EEST Organization: Sonera corp Internet services Xref: g2news2.google.com comp.lang.ada:4819 Date: 2006-06-19T08:09:51+00:00 List-Id: I am trying to process files in a directory. They have to be processed in alphabetical order. With following code I get a nice sorted list on Windows XP but not sorted at all on Linux Debian. Have I missed something that switches the sorting on on Debian (Sarge)? with Gnat.Directory_Operations; with Ada.Command_Line; with Ada.Exceptions; with Ada.Text_IO; with POSIX; with POSIX_Files; with Ada.Strings.Fixed; procedure Ordning is use Ada; use Ada.Command_Line; use Ada.Text_IO; use POSIX; use POSIX_Files; procedure Display (Dirent : in Directory_Entry; Quit : in out Boolean) is File_Name : String := To_String (Filename_Of (Dirent)); begin Put_Line (File_Name); end Display; procedure Display_Directory is new For_Every_Directory_Entry (Action => Display); begin declare use Gnat.Directory_Operations; This_Dir : Dir_Type; This_File: Dir_Name_Str (1..50); Last : Natural; begin -- -- First using Gnat.Directory_Operations -- Put_Line ("First using Gnat.Directory_Operations"); Put_Line ("-------------------------------------"); Open (This_Dir, Get_Current_Dir); loop Read (This_Dir, This_File, Last); exit when Last=0; Put_Line (This_File (1..Last)); end loop; Close (This_Dir); Put_Line ("-------------------------------------"); end; -- -- next using POSIX -- Put_Line ("next using POSIX"); Put_Line ("-------------------------------------"); Display_Directory (To_POSIX_String (".")); exception when E : others => Put_Line (Exceptions.Exception_Name (E) & " - " & Exceptions.Exception_Message (E) & " : " & POSIX.Image (POSIX.Get_Error_Code)); end Ordning; TIA -- Anders