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

[REBOL] Lockup on binary 'skip

From: tim::johnsons-web::com at: 21-Sep-2001 9:12

Hi: I'm seeing a failure in the following code which attempts 'skip in a binary port connection. The test code follows this message, and a test file follows the test code. What am I doing wrong here? thnx: tj #!/usr/bin/rebol -cs REBOL [ Title: "Random Read" Date: 12-Nov-1999 Author: "Bohdan Lechnowsky" Email: [bo--rebol--com] File: %random-read.r Purpose: { To provide a way to read a file at a certain position for a certain number of characters. Does not read the entire file into memory...only the part the user specifies. Also now has a /binary refinement. } Category: [script utility file] ] random-read: func [ {Reads only the specified portion of a file.} filename [file!] {Name of the file to read from} start [integer!] {Position to start reading from} length [integer!] {Number of bytes (characters) to read} /binary /local result ][ either binary [ print "opening binary" print "##################" trace on file: open/binary/direct filename trace off ][ file: open/direct filename ] print "attempting binary skip" print "##################" trace on skip file start ; in /binary, the process seems to lock up here. trace off result: copy/part file length close file result ] print "Content-Type: text/html^/" ; print "<pre>" print random-read/binary %test.txt 5 5 ;print random-read %test.txt 5 5 ;;;;;;;test file: test.txt line one line two line three line four line five