View Problem

Write a string to a file

DiskEdit
python
open('test.txt', 'wt').write('Hello World!')
ExpandDiskEdit
erlang
Line = "This line overwites file contents!\n",
{ok, IODevice} = file:open("test.txt", [write]), file:write(IODevice, Line), file:close(IODevice).
ExpandDiskEdit
clojure
(with-out-writer "output.txt" (println "Hello file!"))
ExpandDiskEdit
cpp C++/CLI .NET 2.0
IO::StreamWriter^ stream;

try
{
stream = gcnew IO::StreamWriter("test.txt", false);
stream->WriteLine("This line overwites file contents!");
}

Submit a new solution for python, erlang, clojure, or cpp
There are 15 other solutions in additional languages (csharp, fantom, fsharp, groovy ...)