From: "Brian Schröder" Date: 2005-10-22T17:06:18+09:00 Subject: Re: newb question? On 21/10/05, daz wrote: > > Dirk Meijer wrote: > > hi everyone, i've got a noobish question.. > > is there a way to create a new file (html in this case) > > and write stuff into it? > > there probably is.. > > i'm using Ruby 1.8.2 under windows xp > > greetings, Dirk. > > > Many ways - here's a simple one: > > > fname = 'C:\TEMP\dirk_2005_10_21.html' > > File.open(fname, 'w') do |fo| > fo.puts('') > fo.puts('') > end > > puts File.read(fname) > > #-> > #-> > > > daz > I'm using debian, but as I understand it you should use forward slashes under windows too. So fname = 'c:/temp/dirk.html' would be better. That also saves you from bugs like this one fname = "c:\temp\dirk.html" which are not so obvious to spot. Regards, Brian > > > > -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/