From: "David A. Black" Date: 2005-11-28T10:59:03+09:00 Subject: Re: Case of the missing bytes Hi -- On Mon, 28 Nov 2005, speechexpert wrote: > Hi - Thanks for previous help, very useful. > > At this point I have a problem: > > I run Zlib (a compression class) on a string. It outputs a string of bytes > (binary) Call it bout. (bout = Zlib::Deflate.deflate(instr) ) > I go bout.length It is 19994 > Then I open a f = File.new(filename, "a") > I go f.write(bout) > > At this point, the file is bigger than 19994. > > What gives?? > > I know this is something simple, can anyone tell me what is going on? > > (I tried "ab" for the mode, but didn't help.) "a" is going to append, so maybe if you've run your program twice you've actually written the data twice to the file. "w" will overwrite the file if it already exists, so you probably want that. David -- David A. Black dblack@wobblini.net