Read and write text files using Sitemagic CMS

It can be useful to read and write data to and from text files. This is possible using the SMTextFileWriter and SMTextFileReader classes. The following examples demonstrate how easy this is.
Write to text file
$writer = new SMTextFileWriter("messages.txt");
$writer->Write("Hello world");
$writer->Close();
Read from text file
$reader = new SMTextFileReader("messages.txt");
$content = $reader->ReadAll();