Maptitude GISDK Help |
Generates a valid and unused file name with a given specification, but does not delete such files on shutdown.
Added to Version 2019.
name = GetRandFileName(string path)
Argument |
Contents |
path |
Null, or a full or partial path, with an optional extension |
A string containing a full path, file name, and extension (if specified).
The path argument can be null.
The default path is the temporary folder returned by GetTempPath().
The file name is always generated for you, even if you specify a file name.
If an extension, with a leading period, is provided in the path argument it will be used. Otherwise, the file name will have no extension.
A partial path not starting with slashes will be relative to the program folder (directory).
A partial path starting with slashes will be relative to the root of your C: drive.
A path starting with "X:\\" where X is a drive letter and colon will just have the temporary file name inserted.
The folders in the path may have the 8.3 naming convention, with long folder names truncated to six characters plus a tilde (~) and a digit to make them unique.
GetRandFileName() returns the name of a file that does not exist.
Files created with GetRandFileName() in the temporary folder returned by GetTempPath() will be deleted. Files created in other folders will not be deleted.
// In all examples:
// - The temporary file name is shown as "ttt"
// - The user name is shown as "user"
// - Thrame prog folder is shown as "C:\Program Files\Maptitude"
tmp = GetRandFileName() // tmp = "C:\DOCUME~1\user\LOCALS~1\Temp\Maptitude\ttt"
tmp = GetRandFileName(".dbf") // tmp = "C:\DOCUME~1\xxx\LOCALS~1\Temp\Maptitude\ttt.dbf"
tmp = GetRandFileName("Temp\\.dbf") // tmp = "C:\Program Files\Maptitude\Temp\ttt.dbf"
tmp = GetRandFileName("\\Temp\\.dbf") // tmp = "C:\Temp\ttt.dbf"
tmp = GetRandFileName("E:\\Temp\\.dbf") // tmp = "E:\Temp\ttt.dbf"
tmp = GetRandFileName("H:\\MyFiles\\MyData\\") // tmp = "H:\MyFiles\MyData\ttt"
Function |
Summary |
Generates a valid and unused file name with a given specification |
|
Gets the name of the directory used by Maptitude to store temporary files |
©2025 Caliper Corporation | www.caliper.com |