comp.lang.ada
 help / color / mirror / Atom feed
* GNAT: Handling of textfile end-of-page
@ 1997-06-18  0:00 Jakob Heinemann
  1997-06-19  0:00 ` Anonymous
  0 siblings, 1 reply; 3+ messages in thread
From: Jakob Heinemann @ 1997-06-18  0:00 UTC (permalink / raw)



Hi!


I'm running GNAT 3.09 (gcc 2.72) on a Sun Solaris 2.5.
I have trouble detecting special characters in a textfile
that I read.

In the source text file that I read, pages are separated
with FF (FormFeed) characters, you know ASCII 12. =


In the files the FF-character can appear at any place on =

a line. The Ada.text_io-package can only detect new-page
as a combination of <new-line><ff> which is not satisfactory
for me. None of the ways I've tried, reading single characters
from the file, will return a FF-character. =


The opposite is on the other hand possible. I can write to
text files using ada.text_io.put(character'val(12)) and
it will appear on the outfile anywhere on a line, but then =

I can't read it back and detect the FF. =


If anyone can help me with this problem I'll be very happy!

Please help me! =


  /Jakob :)

PS: Please also make a direct reply to my e-mail! =


mailto:Jakob.Heinemann@ericsson.com
Ericsson Saab Avionics AB Link=F6ping
+46 13 284249




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

* Re: GNAT: Handling of textfile end-of-page
  1997-06-18  0:00 GNAT: Handling of textfile end-of-page Jakob Heinemann
@ 1997-06-19  0:00 ` Anonymous
  1997-06-20  0:00   ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Anonymous @ 1997-06-19  0:00 UTC (permalink / raw)



On Wed, 18 Jun 1997 17:40:16 +0200, Jakob Heinemann
<Jakob.Heinemann@ericsson.com> wrote:

> Hi!
> 
> 
> I'm running GNAT 3.09 (gcc 2.72) on a Sun Solaris 2.5.
> I have trouble detecting special characters in a textfile
> that I read.
> 
> In the source text file that I read, pages are separated
> with FF (FormFeed) characters, you know ASCII 12. =
> 
> 
> In the files the FF-character can appear at any place on =
> 
> a line. The Ada.text_io-package can only detect new-page
> as a combination of <new-line><ff> which is not satisfactory
> for me. None of the ways I've tried, reading single characters
> from the file, will return a FF-character. =
> 
> 
> The opposite is on the other hand possible. I can write to
> text files using ada.text_io.put(character'val(12)) and
> it will appear on the outfile anywhere on a line, but then =
> 
> I can't read it back and detect the FF. =
> 
> 
> If anyone can help me with this problem I'll be very happy!
> 
> Please help me! =
> 
> 
>   /Jakob :)
> 
> PS: Please also make a direct reply to my e-mail! =
> 
> 
> mailto:Jakob.Heinemann@ericsson.com
> Ericsson Saab Avionics AB Link=F6ping
> +46 13 284249
> 
> 

Try instantiating Sequential_Io for type Character:

  package Character_Io is new Ada.Sequential_Io (Character);

and reading the file with this. You should be able to read the FF
characters OK.

Jeff Carter  PGP:1024/440FBE21
My real e-mail address: ( carter @ innocon . com )
"Now go away, or I shall taunt you a second time."
Monty Python & the Holy Grail

Posted with Spam Hater - see
http://www.compulink.co.uk/~net-services/spam/

























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

* Re: GNAT: Handling of textfile end-of-page
  1997-06-19  0:00 ` Anonymous
@ 1997-06-20  0:00   ` Robert Dewar
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1997-06-20  0:00 UTC (permalink / raw)



Jeff Carter says

<<Try instantiating Sequential_Io for type Character:
 
  package Character_Io is new Ada.Sequential_Io (Character);
 
and reading the file with this. You should be able to read the FF
characters OK.>>

A far too heavy Ada 83 solution that is by no means guaranteed to work
in any case, since there is no assurance that sequential IO will use
compatible formats (for example it might pad every record to four characters)

The proper solutoin in Ada 95 is to use Stream_IO.





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

end of thread, other threads:[~1997-06-20  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-18  0:00 GNAT: Handling of textfile end-of-page Jakob Heinemann
1997-06-19  0:00 ` Anonymous
1997-06-20  0:00   ` Robert Dewar

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