comp.lang.ada
 help / color / mirror / Atom feed
* read file into array to compare
@ 2004-03-09 11:55 david
  2004-03-09 12:14 ` Samuel Tardieu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: david @ 2004-03-09 11:55 UTC (permalink / raw)


hey,
Absoulte Beginner!! Don't want to give up.

Use array, record, an array of records how?
How to compare array or records (so not to do it one at a time)

trying to read a text file with names and address and postcodes.

I've written; do you want to process file which file to proccess, and
check if file is there, then....

Need to read txt file, (format: 3 lines of text, empty line, 3 lines
of text, empty line and so on)
need to store so to compare
first line upto a ',' and after ',' the rest of line
second line completly
third line completly

Then have to check if BOTH first line upto',' and third line are same.
if they are i've to put the both entries (all 3 lines of each on
screen)

Could someone give me a start please.
a scratchy example would be ideal.



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

* Re: read file into array to compare
  2004-03-09 11:55 read file into array to compare david
@ 2004-03-09 12:14 ` Samuel Tardieu
  2004-03-09 12:19 ` Preben Randhol
  2004-03-09 13:27 ` Marius Amado Alves
  2 siblings, 0 replies; 4+ messages in thread
From: Samuel Tardieu @ 2004-03-09 12:14 UTC (permalink / raw)


>>>>> "David" == david  <davidmcroberts@hotmail.com> writes:

David> How to compare array or records (so not to do it one at a time)

Use "=".

  Sam
-- 
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/sam



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

* Re: read file into array to compare
  2004-03-09 11:55 read file into array to compare david
  2004-03-09 12:14 ` Samuel Tardieu
@ 2004-03-09 12:19 ` Preben Randhol
  2004-03-09 13:27 ` Marius Amado Alves
  2 siblings, 0 replies; 4+ messages in thread
From: Preben Randhol @ 2004-03-09 12:19 UTC (permalink / raw)


On 2004-03-09, david <davidmcroberts@hotmail.com> wrote:
> hey,
> Absoulte Beginner!! Don't want to give up.

Good :-)

http://www.it.bton.ac.uk/staff/je/adacraft/

> Use array, record, an array of records how?

http://www.it.bton.ac.uk/staff/je/adacraft/ch06.htm

> Need to read txt file, (format: 3 lines of text, empty line, 3 lines

http://www.it.bton.ac.uk/staff/je/adacraft/ch07.htm#7.5

-- 
Preben Randhol -------------- http://www.pvv.org/~randhol/Ada95 --
                 �For me, Ada95 puts back the joy in programming.�



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

* Re: read file into array to compare
  2004-03-09 11:55 read file into array to compare david
  2004-03-09 12:14 ` Samuel Tardieu
  2004-03-09 12:19 ` Preben Randhol
@ 2004-03-09 13:27 ` Marius Amado Alves
  2 siblings, 0 replies; 4+ messages in thread
From: Marius Amado Alves @ 2004-03-09 13:27 UTC (permalink / raw)
  To: comp.lang.ada

> Could someone give me a start please.
> a scratchy example would be ideal.

procedure Scratchy_Example is
  type Record is array (1 .. 3) of Unbounded_String;
  A, B : Record;
  No_More_Records : exception;
  procedure Get_Record (X : out Record) is ...
  function Upto_Comma (X : Unbounded_String) return String is ...
  ...
begin
  loop
    Get_Record (A);
    Get_Record (B);
    if Upto_Comma (A (1)) = Upto_Comma (B (1)) and A (3) = B (3) then
      Show_Records;
    end if;
  end loop;
exception
  when No_More_Records => Done;
end;



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

end of thread, other threads:[~2004-03-09 13:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-09 11:55 read file into array to compare david
2004-03-09 12:14 ` Samuel Tardieu
2004-03-09 12:19 ` Preben Randhol
2004-03-09 13:27 ` Marius Amado Alves

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