hi guys,
I am working on a C# app that needs to create directories on the fly.
security settings enforced by our ISP do not allow us to use the
standard .NET calls, so I am forced to resort to a DllImport of the COM
library 'msvcrt.dll'. however I am not familiar with calling COM
objects so I have questions...
1) how does the "destroy every COM object you create" rule apply here?
with the code below am I creating something that needs to be
destroyed?
2) if this function is called often what are the performance
consequences?
[DllImport("msvcrt.dll", SetLastError=true)]
static extern int _mkdir(string path);
/// <summary>
/// This function should provide safe substitude for
Directory.CreateDirectory()
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
static DirectoryInfo CreateDirectory(string sPath)
{
int iCode = _mkdir(sPath);
if (iCode != 0)
{
throw new ApplicationException("Error calling [msvcrt.dll]:_mkdir(" +
sPath + "), error code: " + iCode.ToString());
}
return new DirectoryInfo(sPath);
}
thx a million