Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Buffered file reading

From: mat::eurogamer::net at: 6-Apr-2001 19:13

Heya Mat, MB> inp: open/binary/direct ftp://ftp.site.com/big-file.bmp MB> out: open/binary/new/direct %big-file.bmp MB> buf-size: 200000 MB> buffer: make binary! buf-size + 2 MB> while [not zero? size: read-io inp buffer buf-size][ MB> write-io out buffer size MB> total: total + size MB> print ["transferred:" total] MB> ] Actually, I got this working; inp: open/binary/direct ftp://ftp.site.com/big-file.bmp out: open/binary/new/direct %big-file.bmp buf-size: 200000 buffer: make binary! buf-size + 2 total: 0 while [not zero? size: read-io inp buffer buf-size][ write-io out buffer size clear buffer total: total + size print ["transferred:" total] ] close inp close out This works. The notable difference being the clear buffer, which was actually just a guess from me since I don't really know what it does other than resetting a pointer. -- Mat Bettinson - EuroGamer's Gaming Evangelist with a Goatee http://www.eurogamer.net | http://www.eurogamer-network.com