nelson wrote: > Hi, i'm having some trouble with a file in binary mode on winxp. > with this code: > > File.open( 'output.out', 'wb+' ) {|fd| > bin_data = [0].pack('c') > fd.putc bin_data > fd.putc "\000" > fd.putc 0x0 > fd.putc 0 > fd.putc 1 > } > > have this result > > 0d0a0d0a0d0a0d0a01 > It's OK on Windows 98se + ruby 1.8.3 (2005-05-12) [i586-bccwin32] 00000000h: 00 00 00 00 01 ; ..... File.open('output.out', 'rb') {|fd| puts fd.read.dump} #-> "\000\000\000\000\001" Your script is OK. Make sure you are using a reliable viewer to confirm the result. If there's still a problem, please let us hear. daz