comp.lang.ada
 help / color / mirror / Atom feed
* Reading "leftover" chunks from files
@ 1999-08-20  0:00 Matthew
  1999-08-20  0:00 ` Matthew
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Matthew @ 1999-08-20  0:00 UTC (permalink / raw)


Greetings,

This is a "what's the best way of doing this" question.

I want to read in a file so that I can get fixed-length chunks of data
backwards, and also read in whatever data (smaller than the chunk size)
is left behind at the end of the file.

EG
If the file I'm reading is:

[ABC|DEF|GHI|JK] (where | represents a chunk border, not an actual byte)

I want to be able to read:
JK, then
GHI, then
DEF, then
ABC

I'd say Direct_IO comes into it, and the full-sized chunks (eg ABC) are
easy to get, but how do I pick up the JK without scanning through the
whole file?

MB
Email: ua.ten.qu@olokom (backwards)
-- 
How am I supposed to hallucinate with all of these coloured lights
distracting me?




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

* Re: Reading "leftover" chunks from files
  1999-08-20  0:00 Reading "leftover" chunks from files Matthew
@ 1999-08-20  0:00 ` Matthew
  1999-08-20  0:00 ` Jean-Pierre Rosen
  1999-08-20  0:00 ` Robert Dewar
  2 siblings, 0 replies; 5+ messages in thread
From: Matthew @ 1999-08-20  0:00 UTC (permalink / raw)


Greetings,

Ooops, wrong email address: ua.ten.qu@okolom
-- 
How am I supposed to hallucinate with all of these coloured lights
distracting me?




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

* Re: Reading "leftover" chunks from files
  1999-08-20  0:00 Reading "leftover" chunks from files Matthew
  1999-08-20  0:00 ` Matthew
  1999-08-20  0:00 ` Jean-Pierre Rosen
@ 1999-08-20  0:00 ` Robert Dewar
  1999-08-20  0:00   ` tmoran
  2 siblings, 1 reply; 5+ messages in thread
From: Robert Dewar @ 1999-08-20  0:00 UTC (permalink / raw)


In article <37BCD2F1.E0AECF04@Think.So>,
  Matthew <I.Dont@Think.So> wrote:
> Greetings,
>
> This is a "what's the best way of doing this" question.
>
> I want to read in a file so that I can get fixed-length chunks
of data
> backwards, and also read in whatever data (smaller than the
chunk size)
> is left behind at the end of the file.

Direct_IO and Sequential_IO are NEVER appropriate for this kind
of job, since they output data in implementation dependent form.
Always use stream_io for a task like this, and then you have
complete control over what you read, and from where you read
it in the file.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




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

* Re: Reading "leftover" chunks from files
  1999-08-20  0:00 ` Robert Dewar
@ 1999-08-20  0:00   ` tmoran
  0 siblings, 0 replies; 5+ messages in thread
From: tmoran @ 1999-08-20  0:00 UTC (permalink / raw)


>Direct_IO and Sequential_IO are NEVER appropriate for this kind
>of job, since they output data in implementation dependent form.
>Always use stream_io for a task like this, and then you have
>complete control over what you read, and from where you read
>it in the file.
  Don't forget that for streams "complete control" also means
"responsibility", since the default 'Read and 'Write are
implementation dependent and may or may not do what you
want or expect.




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

* Re: Reading "leftover" chunks from files
  1999-08-20  0:00 Reading "leftover" chunks from files Matthew
  1999-08-20  0:00 ` Matthew
@ 1999-08-20  0:00 ` Jean-Pierre Rosen
  1999-08-20  0:00 ` Robert Dewar
  2 siblings, 0 replies; 5+ messages in thread
From: Jean-Pierre Rosen @ 1999-08-20  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]

Matthew <I.Dont@Think.So> a �crit dans le message :
37BCD2F1.E0AECF04@Think.So...
.
>
> I want to read in a file so that I can get fixed-length chunks of data
> backwards, and also read in whatever data (smaller than the chunk size)
> is left behind at the end of the file.

I have written a package called Direct_Text_IO. It is a mixture of Direct_IO
and Text_IO, i.e. it allows random access in a text file.
It provides usual operations on Character and strings, and deals properly
with end of lines and end of pages.
It is not finalized (i.e. I didn't yet write the documentation); once it is
done, I will put it on Adalog's components page.
In the mean time, send me a note if you want to try it (my ISP refuses
attachments in this newsgroup).
Feel free to use it and report any problem you may encounter !

--
---------------------------------------------------------
           J-P. Rosen (Rosen.Adalog@wanadoo.fr)
Visit Adalog's web site at http://perso.wanadoo.fr/adalog











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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-20  0:00 Reading "leftover" chunks from files Matthew
1999-08-20  0:00 ` Matthew
1999-08-20  0:00 ` Jean-Pierre Rosen
1999-08-20  0:00 ` Robert Dewar
1999-08-20  0:00   ` tmoran

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