comp.lang.ada
 help / color / mirror / Atom feed
* sequential search
@ 2003-03-09 18:08 David
  0 siblings, 0 replies; 4+ messages in thread
From: David @ 2003-03-09 18:08 UTC (permalink / raw)


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.



^ permalink raw reply	[flat|nested] 4+ messages in thread
* RE: sequential search
@ 2003-03-10 13:09 Beard, Frank Randolph CIV
  2003-03-10 17:27 ` Martin Krischik
  0 siblings, 1 reply; 4+ messages in thread
From: Beard, Frank Randolph CIV @ 2003-03-10 13:09 UTC (permalink / raw)
  To: comp.lang.ada mail to news gateway

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



^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <87C00083D21D6944A12CB3F8C22DBEEE18821B@NAEAWNYDEX08VA.nadsusea.nads.navy.mil>]

end of thread, other threads:[~2003-03-10 17:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-09 18:08 sequential search David
  -- strict thread matches above, loose matches on Subject: below --
2003-03-10 13:09 Beard, Frank Randolph CIV
2003-03-10 17:27 ` Martin Krischik
     [not found] <87C00083D21D6944A12CB3F8C22DBEEE18821B@NAEAWNYDEX08VA.nadsusea.nads.navy.mil>
2003-03-10 14:13 ` David C. Hoos

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