Small Basic - Temporary Files

Some programs require temporary files during their execution. The files are temporary because they aren’t usually needed after the program ends. The program uses these files to store temporary results. For example, when you create a Small Basic program in the IDE and run it before you save it, the Small Basic compiler creates a temporary executable file (and other temporary files) in order to run your program. Once finished, it might delete these files because they’re no longer needed.

The File object provides the GetTemporaryFilePath() method to create a new temporary file for you; it returns the full file path of the created file. For example, look at the following statements:

path = File.GetTemporaryFilePath()

TextWindow.WriteLine(path)

That code displayed the following output in the text window:

C:\Users\majed\AppData\Local\Temp\tmp6093.tmp

When I checked the displayed path (of course, your path will be different), I found an empty file tmp6093.tmp there. Each time you call this function, a new temporary file is created for you.

 

 

Do you have any questions? Ask us! We're full of answers and other fine things!

Head to the Small Basic forum to get the most answers to your questions: 

https://social.msdn.microsoft.com/Forums/en-US/smallbasic/threads/   

And go to https://blogs.msdn.com/SmallBasic to download Small Basic and learn all about it!

   

Have a Small and Basic day,

   - Ninja Ed & Majed Marji