What language are you writing in? In C#, you can use System.IO.Path.GetTempFileName() / System.IO.Path.GetTempPath()