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 05:25:03 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!freenix!enst.fr!not-for-mail From: "Beard, Frank Randolph CIV" Newsgroups: comp.lang.ada Subject: RE: sequential search Date: Mon, 10 Mar 2003 08:09:14 -0500 Organization: ENST, France Message-ID: 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: quoted-printable X-Trace: avanie.enst.fr 1047301772 56732 137.194.161.2 (10 Mar 2003 13:09:32 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 10 Mar 2003 13:09:32 +0000 (UTC) To: "comp.lang.ada mail to news gateway" Return-Path: X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: sequential search Thread-Index: AcLmZy3TssBxmzo8QKyvu/iQm5J08gAnR0Ug X-OriginalArrivalTime: 10 Mar 2003 13:09:14.0980 (UTC) FILETIME=[4006C240:01C2E706] X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) 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:35124 Date: 2003-03-10T08:09:14-05:00 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