Ruby program to write text into the file
# Create a text file.
fobj = File.new("MyFile.txt", "w");
# Write data into file
fobj.syswrite("Sample Text");
# Close file object
fobj.close();
puts "File created successfully";
Output:
File created successfully
