View Subcategory

Write a string to a file

scala
FileUtils.writeStringToFile(new File("test.txt"), "This line overwites file contents!")
val fw = new FileWriter("test.txt") ; fw.write("This line overwites file contents!") ; fw.close()
csharp
System.IO.File.WriteAllText("filename.txt", "Some text to write to the file");

Append to a file

scala
val fw = new FileWriter("test.txt", true) ; fw.write("This line appended to file!") ; fw.close()
csharp
System.IO.File.AppendAllText("filename.txt", "Some text to append to the file");