From: speechexpert Date: 2005-11-28T21:11:58+09:00 Subject: Re: Case of the missing bytes As far as appending, I erase the file every time to start again. The problem is I n eed to pack the binary string and don't know how. (yet) JB ----- Original Message ----- From: "David A. Black" To: "ruby-talk ML" Sent: Sunday, November 27, 2005 8:59 PM 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 > >