Sample Files program in Ruby Programming


Sample Files program in Ruby Programming


File.new("input.txt", "w+")
File.new("temp.txt", "r+")
File.new("output.txt","a+")
myfile = File.open("input.txt", "w+")
myfile.puts "Hai welcome to files in ruby programming "
myfile.close
File.zero?("output.txt")
puts "open file"
check_file = gets.chomp
test = open(check_file)
puts "The file #{check_file}"
puts test.read

Comments

Popular posts from this blog

how to customize dashboard in active admin gem in rails 4

fibonacci series in Ruby

Simple calculator using JQuery and HTML..