Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another Pascal implementation.

Other implementations
import "io/ioutil"
tmpfile, err := ioutil.TempFile("", "")
import std.stdio;
auto f = File.tmpfile();
require 'tempfile'
file ='foo') 
import tempfile
file = tempfile.TemporaryFile()
$f = tmpfile();
use tempdir::TempDir;
use std::fs::File;
let temp_dir = TempDir::new("prefix")?;
let temp_file = File::open(temp_dir.path().join("file_name"))?;
import System.IO.Temp
withTempFile $ \f -> do
  -- do something with f
open (newunit=u,status="scratch")
#include <stdlib.h>
const char tmpl[] = "XXXXXX.tmp";
int fd = mkstemp(tmpl);
use Path::Tiny qw(tempfile);
my $path = tempfile;
using System.IO;
string file = Path.GetTempFileName();
(ns programming-idioms
  (:import [ File]))
(File/createTempFile "prefix" "suffix")
(ns programming-idioms
  (:import [ File]))
(File/createTempFile "prefix" "suffix" (new File "/tmp"))
file = io.tmpfile()