64 bit ports
The potential size of files has changed since REBOL 2.0 was released. It was once highly unlikely that you'd refer to a file larger than 2GB. These days, it's become a regular thing for many users.
The new port design of REBOL 3.0 is now 64 bit. Both the size of the file and the index into the file are 64 bit.
So, this code will work for "any size" files:
f: open/binary %from-file
t: open/binary/new %to-file
while [data: take f 100000] [append t data]
close f
close t
A few notes:
- What's that take function? For now, just think of it as a copy with a remove.
Unlike copy, take eats the input. This works for all series, not just ports.
(I need to discuss take in a separate article.)
- There is a subtle but important change shown here. Do you see it?
In R3, a port index is no longer part of the reference, it is part of the port value.
But, that's also the subject of another article.
5 Comments
|