On 13/10/17 02:58, Michael C wrote:

>         end = current_address + mbi.RegionSize - 7
> 
> then it doesn't complain anymore. I think it's because I ran this in a
> while loop with start += 1
> so in the last 7 bytes, I'd be reading past the end of this memory chunk.
> 
> Is this right?

Yes, almost certainly. That's what both Steve and I were
alluding to in our earlier responses, you were incrementing
by 1 byte but reading more than one byte so there was a
high probability of you reading past the end.

But subtracting 7 is only the correct answer if you
are always reading 8 byte blocks, if you are reading
different length blocks (for int/short/char etc) then
you might need to do some kind of dynamic check based
on sizeof(chunk)...

if index+sizeof(chunk) > end
   data = read(chunk)
else break

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to