No such file or directory - ruby

ruby

Solution

In a double quoted string, "\a" is a non-printable bel character. Similar to how "\n" is a newline. (I think these originate from C)

You don't have a file with name "C:<BEL>bc.rb" which is why you get the error.

To fix, use single quotes, where these interpolations don't happen:

content = File.read('C:\abc.rb')

Problem

I am trying to read the contents of the file from a local disk as follows : ``` content = File.read("C:\abc.rb","r") ``` when I execute the rb file I get an exception as Error: No such file or directory .What am I missing in this?

Original source