时间: 2021-07-31 作者:daque
path.gettemppath 本领[c#]请拜见path 类 | path 分子 | system.io 定名空间 诉求平台: windows 98, windows nt 4.0, windows millennium edition, windows 2000, windows xp home edition, windows xp professional, windows .net server family.net 框架安定性:environmentpermission 用来对情况变量的无穷制考察。关系的列举:permissionstate.unrestricted 谈话c#c++jscriptvisual basic十足表露归来暂时体例的偶尔文献夹的路途。[visual basic]public shared function gettemppath() as string[c#]public static string gettemppath();[c++]public: static string* gettemppath();[jscript]public static function gettemppath() : string;归来值包括偶尔目次的路途消息的 string。特殊特殊典型 前提 securityexception 挪用方没有所需的权力。 备注底下的代码示例证明 gettemppath 本领的用法。[visual basic] dim temppath as string = path.gettemppath()console.writeline("temporary pathname is '{0}'", temppath)dim tempdir as new directoryinfo(temppath)console.writeline("{0} contains {1} files", temppath, tempdir.getfiles().length)[c#] string temppath = path.gettemppath();console.writeline("temporary path is '{0}'", temppath);directoryinfo tempdir = new directoryinfo(temppath);console.writeline("{0} contains {1} files", temppath, tempdir.getfiles().length);固然,再有个gettempfilename不妨看看----------------------------------------------------------其余一种犹如只能用api了吧[dllimport("kernel32.dll", charset=charset.auto)][return:marshalas(unmanagedtype.u4)]public static extern int gettempfilename(string strpathname,string strprefixstring,[marshalas(unmanagedtype.u4)] uunique,stringbuilder sbtempfilename);