|
-
October 6th, 2002, 10:13 PM
#1
How to get "Temp" folder path?
How can I get "Temp" folder path with C#.
I've looked up System.Environment.SpecialFolder,
but "Temp" wasn't there.
In win 9X the temp path is typically
"C:\Windows\Temp"
In windows 2000,XP
"C:\\Windows\User Name\Local Settings\Temp
My current dirty solution is,
Code:
string tempinternet=System.Environment.GetFolderPath(
System.Environment.SpecialFolder.InternetCache);
string temppath=tempinternet.Substring(0,tempinternet.LastIndexOf("\\"))
+"\\temp";
But is this safe?
Last edited by Sin Jeong-hun; October 6th, 2002 at 10:16 PM.
ALEA JACTA EST ET TEMPUS FUGIT
-
October 6th, 2002, 10:34 PM
#2
From VS.Net Help
The following example code demonstrates the use of the GetTempPath method.
string tempPath = Path.GetTempPath();
Console.WriteLine("Temporary path is '{0}'", tempPath);
Andy Tower
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|