A
Adrian Roskrow
Hi
I need to read from a usb connected barcode reader and I thought ruby
would be a good way to do it. I have written a quick program to read
from the $stdin object but it just sits there and waits. Im very new to
ruby so I have probably made a fundamental mistake. Can anyone see what
I have done, or can anyone point me in the right direction or provide an
example?
Below is a simple bit of code
#!/usr/bin/env ruby
text = $stdin.read
lines = text.split("\n")
i = 1
for line in lines do
puts "#{i}. " + line
i += 1
end
Adrian
I need to read from a usb connected barcode reader and I thought ruby
would be a good way to do it. I have written a quick program to read
from the $stdin object but it just sits there and waits. Im very new to
ruby so I have probably made a fundamental mistake. Can anyone see what
I have done, or can anyone point me in the right direction or provide an
example?
Below is a simple bit of code
#!/usr/bin/env ruby
text = $stdin.read
lines = text.split("\n")
i = 1
for line in lines do
puts "#{i}. " + line
i += 1
end
Adrian