Create a temporary folder or file

With the Icetips Utilities it is very easy to get the location of the Temp folder and get a temporary file name. 

ITS      ITShellClass  
FileName CString(1025)
  Code  
FileName = Folder & ITS.GetTempFilename()

GetTempFilename will give you a temporary filename in the Temp folder. 

Lets say that you want to create a subfolder in the Temp folder.  Then you need to add a few more lines of code.

ITS      ITShellClass 
Folder   CString(1025)
FileName CString(1025)
  Code  
Folder = ITS.GetTempFolder() & 'Icetips\Build Automator'  
ITS.CreateFolder(Folder)
  FileName = Folder & '\' & ITS.GetTempFilename() & '.tmp'

GetTempFolder gives you the path to the Temp folder and CreateFolder creates the subfolder(s) for you.  CreateFolder can create multiple levels in one go.  Note that CreateFolder and CreateDirectory are exactly the same, in fact CreateFolder just calls CreateDirectory, just a different name:)

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk