comp.lang.ada
 help / color / mirror / Atom feed
From: "Beard, Frank Randolph CIV" <frank.beard@navy.mil>
To: "comp.lang.ada mail to news gateway" <comp.lang.ada@ada.eu.org>
Subject: RE: sequential search
Date: Mon, 10 Mar 2003 08:09:14 -0500
Date: 2003-03-10T08:09:14-05:00	[thread overview]
Message-ID: <mailman.8.1047301771.32742.comp.lang.ada@ada.eu.org> (raw)

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



             reply	other threads:[~2003-03-10 13:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-10 13:09 Beard, Frank Randolph CIV [this message]
2003-03-10 17:27 ` sequential search Martin Krischik
     [not found] <87C00083D21D6944A12CB3F8C22DBEEE18821B@NAEAWNYDEX08VA.nadsusea.nads.navy.mil>
2003-03-10 14:13 ` David C. Hoos
  -- strict thread matches above, loose matches on Subject: below --
2003-03-09 18:08 David
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox