comp.lang.ada
 help / color / mirror / Atom feed
From: adam@irvine.com (Adam Beneschan)
Subject: Wide_Text_IO: bad data in text file
Date: 24 Oct 2002 13:32:42 -0700
Date: 2002-10-24T20:32:42+00:00	[thread overview]
Message-ID: <b4682ab7.0210241232.21661408@posting.google.com> (raw)

Question:

When Wide_Text_IO.Get is used to read a character or string from the
text file, and the file contains a sequence of bits that cannot be
interpreted as a character or string, does the language specify what
exception, if any, should be raised?  Or is it
implementation-dependent?

This isn't really a problem with Text_IO.  For Wide_Text_IO, though,
it's likely that the file will be read using a specific encoding
scheme, such as UTF-8; and it is possible for the file to contain
8-bit bytes that do not represent legal encodings in UTF-8 (or other
encoding scheme).

The RM doesn't specifically address this issue, as far as I can tell. 
Data_Error seems to be intended for cases where characters can be read
from the file but they're not in the proper syntax for an integer
(when using an instance of Integer_IO), or a float, or whatever.  The
closest thing I could find was A.13(10), which says "Use_Error is
propagated if an operation is attempted that is not possible for
reasons that depend on characteristics of the external file".  When I
tried a test using GNAT, it raised Constraint_Error, which seems
counterintuitive.

Comments?

				-- thanks, Adam



             reply	other threads:[~2002-10-24 20:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-24 20:32 Adam Beneschan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-10-25  4:56 Wide_Text_IO: bad data in text file Grein, Christoph
2002-10-25 11:48 ` Jean-Pierre Rosen
2002-10-25 15:22 ` Adam Beneschan
2002-10-25 17:22   ` Frank J. Lhota
2002-10-26  1:21     ` Adam Beneschan
replies disabled

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