Save what you read to a file : syswrite « File Directory « Ruby






Save what you read to a file



fileObj = File.new ("C:\\Ruby\\customer_details.txt", "a")

puts "Enter your first name"
first_name=gets
puts "Enter your last name"
last_name=gets
puts "Enter your email address"
email=gets

customer_info=[]
customer_info[0]=first_name
customer_info[1]=last_name
customer_info[2]=email

fileObj.syswrite(customer_info)

 








Related examples in the same category

1.The method syswrite writes the contents of the file.