comp.lang.ada
 help / color / mirror / Atom feed
* End_Of_File does not work as expected...
@ 2000-11-24 23:42 Mika Fischer
  2000-11-25  5:14 ` Jeff Carter
  2000-11-26  0:00 ` Mats Weber
  0 siblings, 2 replies; 7+ messages in thread
From: Mika Fischer @ 2000-11-24 23:42 UTC (permalink / raw)


Hi!

I have a problem with a program I had to write for university.

The program is supposed to read its standard input and write it onto its
standard output.

Why does the following code not work as expected?

procedure Echo is

c: Character;

begin
	while not End_Of_File loop
		Get(c);
		Put(c);
	end loop;
end Echo;

When I compile it and invoke it like in "cat file | ./echo" it throws the
exception END_ERROR which indicates that I tried to read from a file
beyond the end of file.
So why is End_Of_File false when it should be true?

Also if I invoke the program as "./echo" and type for example "ddd" and
press the enter key, the following appears on my screen:

--<snip>--
ddd
ddd
--<snip>--

When I press Enter once more its this:

--<snip>--
ddd
ddd


--<snip>--

I also don't understand why it behaves as it does.

I'm using GNAT 3.13p-2 on Debian GNU/Linux (woody) and Linux
2.4.0-test10.

As you have certainly noticed I don't really have a clue about Ada. So my
apollogies if this question ist just too stupid :-) (And sorry for my
English...)

Thanks for any answers!

Mika



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

end of thread, other threads:[~2000-11-26  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-24 23:42 End_Of_File does not work as expected Mika Fischer
2000-11-25  5:14 ` Jeff Carter
2000-11-25  0:00   ` Mika Fischer
2000-11-25  0:00     ` Jeff Carter
2000-11-26  0:00 ` Mats Weber
2000-11-26  0:00   ` Jeff Carter
2000-11-26  0:00     ` Mats Weber

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