How to write a file programmatically

See also other filesystem topics: