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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b2f463dd5856d07a X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Got me stumped any idea? Date: 1997/10/15 Message-ID: #1/1 X-Deja-AN: 281241859 References: <343F77BF.18CA@unx1.shsu.edu> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-10-15T00:00:00+00:00 List-Id: In article <343F77BF.18CA@unx1.shsu.edu>, stdrat01@unx1.shsu.edu wrote: >I have this file: > >With Ada.Text_IO; Use Ada.Text_IO; >With Ada.Strings.Unbounded; Use Ada.Strings.Unbounded; >Procedure Compare is > >File1 : File_type; >File2 : File_type; >FileOut : File_type; >File1_line : String(1..80); > >Begin > Open(File1,In_File,"NetView.dat"); > Create(FileOut, Out_File, "Data.dat"); > > While (Not End_Of_File(File1)) loop > Get(File1,File1_line); > Skip_Line(File1); > Put_Line(FileOut,File1_Line); > New_Line(FileOut); > End Loop; > > Close(File1); > Close(FileOut); >End Compare; When you're reading text files (it's a pity Text_IO.File_Type isn't named Text_IO.Text_File), it's a good idea to use Text_IO.Get_Line, to read in the entire line. The problem you're having is forgetting to include the other parameter to that subprogram, the Last argument: procedure Compare is File1, FileOut : File_Type; Line : String (1.. 80); Last : Natural; begin ... while not End_Of_File (File1) loop Get_Line (File1, Line, Last); Put_Line (FileOut, Line (1 .. Last)); end loop; ... Will that solve your problem? Get is probably not what you want, because that just reads characters without respect to line terminators; I don't think I've ever used it. Read the RM and carefully compare Get and Get_Line, and note the parameter profile of each procedure. If you have any lines in your input file longer than 80, repost and I'll help you with that. (Let's try the simplest solution first.) -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271