program Write_entire_file; {$APPTYPE CONSOLE} uses System.IoUtils; begin TFile.WriteAllText('filename.txt', 'This file contains a string.'); end.