From: Colby Callahan Date: 2013-02-03T07:11:05+09:00 Subject: Re: Open file that its name given by STDIN.gets --0015175885bc9828d404d4c522bc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable STDIN.read ? The read method reads data from the standard input, until it reaches the end of the file. The EOF is produced by pressing Ctrl + D on Unix or Ctrl + Z on Windows. On Sat, Feb 2, 2013 at 2:00 PM, aref aslani wrote: > Hi all. I'm following the Zed Shaw's ruby tutorials. > in ex15 i've changed this line > > filename =3D ARGV.first > > to > > filename =3D STDIN.gets > > and this is the command line error: > > =E2=86=92 ruby test.rb > test.rb > > test.rb:9:in `initialize': No such file or directory - aref > (Errno::ENOENT) > from test.rb:9:in `open' > from test.rb:9:in `
' > > what is the problem? > P.S. the ruby file is attached. > > Attachments: > > http://www.ruby-forum.com/attachment/8102/Screen_Shot_1391-11-15_at_1.31.= 56_AM.png > > > -- > Posted via http://www.ruby-forum.com/. > --0015175885bc9828d404d4c522bc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
STDIN.read =C2=A0 =C2=A0 ?

The=C2=A0read=C2=A0method reads data from the standard inpu= t, until it reaches the end of the file. The EOF is produced by pressing Ct= rl + D on Unix or Ctrl + Z on Windows.


O= n Sat, Feb 2, 2013 at 2:00 PM, aref aslani <lists@ruby-forum.com>= ; wrote:
Hi all. I'm following the Zed Shaw's= ruby tutorials.
in ex15 i've changed this line

filename =3D ARGV.first

to

filename =3D STDIN.gets

and this is the command line error:

=E2=86=92 ruby test.rb
test.rb
> test.rb:9:in `initialize': No such file or directory - aref (Errno= ::ENOENT)
=C2=A0 from test.rb:9:in `open'
=C2=A0 from test.rb:9:in `<main>'

what is the problem?
P.S. the ruby file is attached.

Attachments:
http://www.ruby-forum.com/attachment/= 8102/Screen_Shot_1391-11-15_at_1.31.56_AM.png


--
Posted via http://= www.ruby-forum.com/.

--0015175885bc9828d404d4c522bc--