Skip to content
Back to formatted view

Raw Message

Message-ID: <4A0822F8.6060700@stats.uwo.ca>
Date: 2009-05-11T13:07:04Z
From: Duncan Murdoch
Subject: readBin: read from defined offset TO defined offset?
In-Reply-To: <gu90rf$q52$1@ger.gmane.org>

On 11/05/2009 7:05 AM, Johannes Graumann wrote:
> Hello,
> 
> With the help of "seek" I can start "readBin" from any byte offset within my 
> file that I deem appropriate.
> What I would like to do is to be able to define the endpoint of that read as 
> well. Is there any solution to that already out there?

Sure:  just use the "n" parameter to readBin.  This will work for any 
type except character, but it doesn't make sense to read those in a 
given range: what do you do if the last one is not zero terminated?  If 
you want the end of block to count as a terminator, then read the block 
as raw, add a null to the end, and then re-read the raw vector.

Duncan Murdoch