From: Gautier <gautier@fakeaddress.nil>
Subject: Re: Q: Index value in case of Ada.Streams.Stream_IO.End_Error
Date: Mon, 24 Apr 2006 19:44:14 +0200
Date: 2006-04-24T19:44:14+02:00 [thread overview]
Message-ID: <444d0e91$1_5@news.bluewin.ch> (raw)
In-Reply-To: <hvsi2e.uhv.ln@hunter.axlog.fr>
Jean-Pierre Rosen:
> If you use 'Read, and there is not enough bytes left in the file, then
> your file is corrupted. You will get End_Error.
> Now, if you want to analyze what happened, here is what you can do:
> 1) before calling 'Read, get the current index (function Index)
> 2) Do a T'Read
> 3) If you get End_Error, do a Set_Index to return where you were, and
> use the Read procedure to get the corresponding array of bytes.
> Then it's up to you...
Fine, it's what I'm doing currently (cf the lines of code in my 1st post).
But since the buffer in question happens to be a byte array,
I'll switch to the Read procedure and just define the buffer as a
Stream_Element_Array.
Thanks
_______________________________________________________________
Gautier -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm
prev parent reply other threads:[~2006-04-24 17:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-22 1:33 Q: Index value in case of Ada.Streams.Stream_IO.End_Error Gautier
2006-04-24 8:11 ` Jean-Pierre Rosen
2006-04-24 14:33 ` Gautier
2006-04-24 16:05 ` Jean-Pierre Rosen
2006-04-24 17:44 ` Gautier [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox