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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2f014c8802ae5d14 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-10 06:14:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!freenix!enst.fr!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada Subject: Re: sequential search Date: Mon, 10 Mar 2003 08:13:38 -0600 Organization: ENST, France Message-ID: References: <87C00083D21D6944A12CB3F8C22DBEEE18821B@NAEAWNYDEX08VA.nadsusea.nads.navy.mil> Reply-To: "comp.lang.ada mail to news gateway" NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1047305649 56977 137.194.161.2 (10 Mar 2003 14:14:09 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 10 Mar 2003 14:14:09 +0000 (UTC) To: "comp.lang.ada mail to news gateway" Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.1 Precedence: list List-Id: comp.lang.ada mail to news gateway List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:35125 Date: 2003-03-10T08:13:38-06:00 The Line counter is maintained for you by Ada.Text_IO -- the number of the line jus read is given by Ada.Text_IO.Line (File) - 1 ----- Original Message ----- From: "Beard, Frank Randolph CIV" To: "comp.lang.ada mail to news gateway" Sent: Monday, March 10, 2003 7:09 AM Subject: RE: sequential search There's good 'ol fashioned Ada.Text_Io.Get_Line. Create a buffer of sufficient size. Call Get_Line to read the file line by line, and then parse the buffer looking for the particular word (maintaining a line counter as you go). If your application is interactive where the user will make multiple queries, you might be better off reading the entire file into a memory buffer and then parsing it. If speed and efficiency are not paramount, then the first approach will probably suffice. Frank -----Original Message----- From: David Does anyone know how a sequential/linear search is created under a txt file (to find a specific word line by line). I have an idea how it is done using an array, but not under a file. Any ideas? Thanks. _______________________________________________ comp.lang.ada mailing list comp.lang.ada@ada.eu.org http://ada.eu.org/mailman/listinfo/comp.lang.ada _______________________________________________ comp.lang.ada mailing list comp.lang.ada@ada.eu.org http://ada.eu.org/mailman/listinfo/comp.lang.ada