Temporary Files

Temporary files, as the name implies, are files that are used by a program as it is running and then are not useful once the program goes away. Unix systems typically store temp files in a well known location so that people know where to clean out files that are left over accidentally. Some systems will clear out the directory that holds the temp files on startup.

A program needs a unique name when it wants to create temporary file so that it does not clash with another file already in the temp directory. If two programs ended up using the same temporary file, one or the other would probably fail in weird and wonderful ways.

Where is this temporary directory? There are a number of calls available for finding a temporary directory ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.