comp.lang.ada
 help / color / mirror / Atom feed
* Re: sequential search
       [not found] <87C00083D21D6944A12CB3F8C22DBEEE18821B@NAEAWNYDEX08VA.nadsusea.nads.navy.mil>
@ 2003-03-10 14:13 ` David C. Hoos
  2003-03-10 15:08   ` ada.text_io.line (was " Peter Hermann
  0 siblings, 1 reply; 2+ messages in thread
From: David C. Hoos @ 2003-03-10 14:13 UTC (permalink / raw)
  To: comp.lang.ada mail to news gateway

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" <frank.beard@navy.mil>
To: "comp.lang.ada mail to news gateway" <comp.lang.ada@ada.eu.org>
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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* ada.text_io.line (was Re: sequential search
  2003-03-10 14:13 ` sequential search David C. Hoos
@ 2003-03-10 15:08   ` Peter Hermann
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Hermann @ 2003-03-10 15:08 UTC (permalink / raw)


David C. Hoos <david.c.hoos.sr@ada95.com> wrote:
> 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

caution: not for standard_input
function line without parameters defaults to standard_output

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 2+ messages in thread

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87C00083D21D6944A12CB3F8C22DBEEE18821B@NAEAWNYDEX08VA.nadsusea.nads.navy.mil>
2003-03-10 14:13 ` sequential search David C. Hoos
2003-03-10 15:08   ` ada.text_io.line (was " Peter Hermann

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