Original post

We programmers often use temporary files and this example shows how we can create and write to one. We used the ioutil package which has functions for just this.
The TempFile() accepts a folder and a prefix. As the folder we get the os’ temp directory (which would be /tmp on unix systems) and for the prefix we use a string, but if we don’t want one, we just pass an empty string.