From: Christian Kruse Date: 2002-02-27T00:35:23+09:00 Subject: Re: Trouble with opening files Hello Chris, Tuesday, February 26, 2002, 4:32:11 PM, you wrote: > I just can't wrap my head around why this little program doesn't work: > #!/usr/bin/env ruby > $stdout.sync= true > File.open("~/ruby/sample/testFile", "r") > a = testFile.gets > puts a > It says: > TestAFile.rb:3:in `open': No such file or directory - > "~/ruby/sample/testFile" (Errno::ENOENT) > from TestAFile.rb:3 > but: > [dslstat473:~/ruby/sample] chrisg% cat testFile > Hello World! > [dslstat473:~/ruby/sample] chrisg% I think, it should work when you write File.open("/home/chrisg/ruby/sample/testFile","r") Most programming languages do not wrap '~' to your home directory. -- Best regards, Christian mailto:ckruse@wwwtech.de