From: krzysztof cierpisz Date: 2009-08-19T00:40:06+09:00 Subject: Re: fromdos dos2unix in ruby > > I tried with following dos2unix.rb script > > > ###### dos2unix.rb ###################### > > out = File.open(ARGV[1],"w") > > > File.open(ARGV[0]).each {|line| > >  out << line.gsub!(/\r$/,'') > > } > > > out.close > > ######################################### > > > this: > > ruby dos2unix.rb u8nl_utf8_tab.dos.txt d > > > works fine on Linux (d with length 408 bytes) but not on Windows, on > > Windows d is a file with 0 bytes > > You are not closing the File object properly so your output might > never get flushed to disk... > > Cheers > > robert > can you let me know how to close it properly? thanks, chris