From: Brian Candler Date: 2009-07-05T18:03:49+09:00 Subject: Re: file.seek and unused bytes Eleanor McHugh wrote: >> 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. I don't believe that's the case today. If it were, then you would have a very easy way to examine the contents of unused sectors on the disk - which would allow you to see other people's deleted files, passwords etc. It was possible on old mainframe systems in the 80's though :-) But today, if you extend a file using seek, you should always read zeros. -- Posted via http://www.ruby-forum.com/.