I'm trying to read from a file, and because my more complex code doesn't work, I came back to basics to see whether it even reads properly. My code:
MyParser.new(STDIN.read).run.lines.each do |line|
p line.chomp
end
I use
ruby program
(it's placed in a bin
directory and I saved it without .rb
)
Now program is waiting for me to write something. I type:
../examples/file.txt
and use CTRL + Z
(I'm on Windows 10). It produces ^Z
and I hit enter.
Now I have an error:
Invalid argument @ rb_sysopen - ../examples/file.txt (Errno::EINVAL)
MyParser
class and its whole logic works fine. I'll be grateful for any hints.