From: Logan Capaldo Date: 2006-04-05T15:58:00+09:00 Subject: Re: Using File.open block to manage svnadmin dump stream On Apr 4, 2006, at 10:47 PM, Brad C. wrote: > unknown wrote: >> I should have posted an example. Your code is opening the file in >> text >> mode. You have to add a 'b' to the mode argument of open to force >> the >> file to be opened in binary mode: >> >> >> File.open("c:/testrb.txt","wb") do |f| >> # write data here via the File object f >> end >> >> Gary Wright > > Ah, I should have been able to come up with that. Thanks. I tried this > and the file sizes remain different though. Might this have to do with > the version of ruby I'm using? Apart from running on windows :\ > > I guess one could create files via strait command expressions, then > modify them via ruby's File class, unless that resaves differently. Is > this something that's normal -different file sizes when creating files > in various ways? > > -- > Posted via http://www.ruby-forum.com/. > ------------------------------------------------------------------ IO#<< ios << obj => ios ------------------------------------------------------------------------ String Output---Writes obj to ios. obj will be converted to a string using to_s. $stdout << "Hello " << "world!\n" produces: Hello world! As you can see, << is more like write or print than puts, while echo will append a new line try file.puts "Test" and see if your file sizes match up then