Split out file functions, add some new ones.
Tempname should be constant length.