comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
To: "comp.lang.ada mail to news gateway" <comp.lang.ada@ada.eu.org>
Subject: Re: sequential search
Date: Mon, 10 Mar 2003 08:13:38 -0600
Date: 2003-03-10T08:13:38-06:00	[thread overview]
Message-ID: <mailman.9.1047305646.32742.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 87C00083D21D6944A12CB3F8C22DBEEE18821B@NAEAWNYDEX08VA.nadsusea.nads.navy.mil

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




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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87C00083D21D6944A12CB3F8C22DBEEE18821B@NAEAWNYDEX08VA.nadsusea.nads.navy.mil>
2003-03-10 14:13 ` David C. Hoos [this message]
2003-03-10 15:08   ` ada.text_io.line (was Re: sequential search Peter Hermann
2003-03-10 13:09 Beard, Frank Randolph CIV
2003-03-10 17:27 ` Martin Krischik
  -- 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