skip on direct mode file port
[1/4] from: anton:lexicon at: 12-Aug-2002 3:02
I run the following code on these two:
REBOL/View 1.2.8.3.1 3-Aug-2002
REBOL/View 1.2.1.3.1 21-Jun-2001
fp: open/direct/binary %test-file.r
fp: skip fp 4
Now I wait for a long time, while cpu is at maximum.
Size of the file is 19 bytes, and it doesn't seem
to matter how far I skip to cause the long wait,
although skipping 0 returns as expected.
What's wrong?
Anton.
[2/4] from: greggirwin::mindspring::com at: 11-Aug-2002 11:38
Hi Anton,
<<
fp: open/direct/binary %test-file.r
fp: skip fp 4
Now I wait for a long time, while cpu is at maximum.
>>
I think it's a known issue that SKIP doesn't work on direct/binary files at
this point. I thought I had heard that the fix would be in soon, but I
haven't seen it yet. I'm willing to wait a bit, assuming they're taking the
time to get it really right, because it will open up a lot of new
possibilities.
--Gregg
[3/4] from: anton:lexicon at: 12-Aug-2002 16:36
I want to read the last 128 bytes of
mpeg audio files.
I have fixed up and am fixing up mp3tool.r
from the script library, which reads id3v1 tags.
Currently, it is reading the whole
file into memory, which is wasteful.
Is there a way to get the file pointer
to the end without reading the whole file?
I have a half-solution:
Do a buffered read, with the buffer
set to 128 bytes, such that the last
buffer contents falls over the last
128 bytes. Or could use a larger buffer
until the last 128 bytes.
Mmm. I don't like it. It's just for fun,
so I can wait, too.
Anton.
[4/4] from: gscottjones:mchsi at: 12-Aug-2002 7:49
Hi, Anton,
From: "Anton"
> I want to read the last 128 bytes of
> mpeg audio files.
<<quoted lines omitted: 12>>
> Mmm. I don't like it. It's just for fun,
> so I can wait, too.
This is not the most efficient method, but it does allow skipping within an
unbuffered access:
my-blk: copy []
fs: size? %license.html
fr: open/direct/binary %license.html
loop (fs - 178) [copy/part fr 1]
loop 178 [append my-blk copy/part fr 1]
close fr
Hope this helps until skip is repaired for direct/binary.
--Scott Jones
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted