Using [IO.Path]::GetTempFileName()

  • Thread starter Thread starter Marco Shaw
  • Start date Start date
M

Marco Shaw

..NET novice**

How does [IO.Path]::GetTempFileName() work? I'm trying to use it to avoid
some kind of race condition, but I need to call it, and get the resulting
temp file into a variable.

Then I'll come back later to actally use that temp file name by writing,
reading, and appending to it later. Eventually, I'll delete it.

I'm just wondering about the creation and deletion criteria...

Marco
 
Hello Marco,

It calls the corresponded WinAPI GetTempFileName function
See details of how a filename is generated http://msdn2.microsoft.com/en-gb/library/aa364991.aspx

MS> .NET novice**
MS>
MS> How does [IO.Path]::GetTempFileName() work? I'm trying to use it to
MS> avoid some kind of race condition, but I need to call it, and get
MS> the resulting temp file into a variable.
MS>
MS> Then I'll come back later to actally use that temp file name by
MS> writing, reading, and appending to it later. Eventually, I'll
MS> delete it.
MS>
MS> I'm just wondering about the creation and deletion criteria...
MS>
MS> Marco
MS>
---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
Back
Top