Desktop Functions: Smart Device Functions:
|
Search Results for "GetTempFileName" in [All]Constants1: MAX_PATH This is the maximum number of characters, usually including a null terminator, of a standard fully-pathed filename for most Windows API functions that operate on filenames (and a few .NET ones, such as Assembly.LoadFrom). Those that fill a buffer with a filename, such as GetTempFileName, expect a buffer of exactly this length. Some functions, such as CreateFile, can be made to accept longer filenames by using the "\\?\" syntax. kernel32
static extern uint GetTempFileName(string lpPathName, string lpPrefixString,
/// The GetTempFileName and GetTempFolderName methods (and overloads) provide
/// the same level of convenience as the managed Path.GetTempFileName (including
static extern uint GetTempFileName(string lpPathName, string lpPrefixString, uint uUnique, [Out] StringBuilder lpTempFileName);
public static string GetTempFileName() {
return GetTempFileName("tmp");
public static string GetTempFileName(string prefix) {
return GetTempFileName(prefix, 0);
public static string GetTempFileName(string prefix, uint unique) {
return GetTempFileName(prefix, unique, Path.GetTempPath());
public static string GetTempFileName(string prefix, uint unique, string basePath) {
// 'sb' needs >0 size else GetTempFileName throws IndexOutOfRangeException. 260 is the most you'd want.
uint result = GetTempFileName(basePath, prefix, unique, sb);
string tempFolderName = GetTempFileName(prefix, unique, basePath);
string tempFile = Win32Utility.GetTempFileName();
Public Shared Function GetTempFileName() As String
public static string GetTempFileName();
public: static String* GetTempFileName();
public static function GetTempFileName() : String; 3: GetTempPath
lngRet = GetTempFileName(astrFoldername, astrPrefix, 0, tempName) |