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

[REBOL] Re: SKIPping in a file

From: g::santilli::tiscalinet::it at: 9-Jul-2001 16:04

Hello Joel! On 08-Lug-01, you wrote: JN> readtail: func [fn [file!] n [integer!] /local sz rp fi JN> mybuf] [ JN> sz: get in info? fn 'size JN> rp: sz + 1 - n JN> print [sz rp] JN> fi: open/binary/direct fn JN> fi: skip fi rp JN> mybuf: copy/part fi n JN> close fi JN> mybuf JN> ] SKIP has always been broken on /DIRECT ports AFAIK (at least, I was never able to make it work). The workaround is using COPY/PART. readtail: func [fn [file!] n [integer!]] [ fn: open/binary/direct fn copy/part fn fn/size - n first reduce [copy/part fn n close fn] ] (NOT TESTED) JN> again shows the correct size/readpoint calculations, but JN> always returns the *first* N bytes of the file, not the JN> *last* N bytes. OPEN/SKIP also seems to give problems, on files at least. (If it worked, you could have replaced your functions with READ/DIRECT/PART and READ/DIRECT/SKIP --- well, the first works anyway). JN> Am I misreading R/CUG or doing something boneheaded here? Or JN> are /SKIP and SKIP broken in View ? I'd like to know, too... Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila --