From: Dirk Meijer Date: 2005-10-22T21:03:04+09:00 Subject: Re: newb question? ------=_Part_26585_12141239.1129982580752 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline now i have another question, is it possible to create a new directory, because when i try that with File.open("./newdir/file.html", 'w') it gives me an error. so is it possible? Dirk. 2005/10/22, Brian Schr=F6der : > > 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 =3D '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 =3D 'c:/temp/dirk.html' > > would be better. That also saves you from bugs like this one > > fname =3D "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/ > > ------=_Part_26585_12141239.1129982580752--