From: Eleanor McHugh Date: 2009-07-04T08:11:40+09:00 Subject: Re: file.seek and unused bytes On 3 Jul 2009, at 23:06, Greg Willits wrote: > So, my question is about those zeros. Does advancing the seek position > (do we still call that the "cursor"?) intentionally and proactively > fill > the unsed bytes with what apparently equates to zero? OR, am I just > getting luck that my test files have used virgin disk space which > yields > zeros, and the seek position just skips bytes which potentially would > contain garbage from previously used disk sectors? > > Can I count on those unused bytes always being zero? Unfortunately you're getting lucky. A seek adjusts the file pointer but doesn't write anything to disk so whilst your 'unused' bytes won't be changing value as a result of writing data to the file unless you write the full record, you can't rely on them not having a value other than zero if you don't. Also you have to consider that zero may itself be a valid data value within a record :) Ellie Eleanor McHugh Games With Brains http://slides.games-with-brains.net ---- raise ArgumentError unless @reality.responds_to? :reason