Limitandoti alla CRT puoi usare le funzioni tmpfile, tmpnam, tempnam (queste ultime due non standard ma molto diffuse).