opens text.txt for reading and writing, and changes the first character of the first line to X. : write « File Directory « Ruby






opens text.txt for reading and writing, and changes the first character of the first line to X.


f = File.open("text.txt", "r+")
f.write "123456"
f.close

 

Related examples in the same category

1.Backing Up to Versioned Filenames