Ruby printing PS after reading file -
Ruby printing PS after reading file -
i wondering happening output. when run code work fine, pass in file name (ex15_sample.txt) , print out. after done printing out file prints out 2 additional characters "ps". thought on why is?
i'm running ruby 2.0.0p576 (x64) on windows 8 64 bit machine.
here code:
# prompts user input on filename print "what name of file printed? " # takes command line argument , assigns variable filename = gets.chomp # declares variable , initializes opening file stored in variable filename txt = open(filename) # prints out string interpolated string puts "here's file #{filename}:" # prints out file stored in variable txt print txt.read # closes file txt.close()
edit: side note, if open file, read , print using irb
not characters. if utilize command ruby ex15.rb
ps powershell prompt. gets printed powershell after every command. has absolutely nil whatsoever ruby. seek running dir
, print ps.
ruby file-io printing
Comments
Post a Comment