⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_27979.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:27979 发表者:gbh 发表日期:2003-01-16 21:08:42
<br>主题:谁知道这么样得到当前目录名!!!谢谢!!!
<br>内容:如题,谢谢!!!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:tjhe 回复日期:2003-01-16 21:20:24
<br>内容:GetCurrentDirectory(....)<BR>&nbsp;&nbsp;&nbsp;&nbsp;CString strDir;<BR>&nbsp;&nbsp;&nbsp;&nbsp;::GetCurrentDirectory(MAX_PATH,strDir.GetBuffer(_MAX_PATH));<BR>&nbsp;&nbsp;&nbsp;&nbsp;strDir.ReleaseBuffer();<BR><BR><BR>或<BR>/* GETDRIVE.C illustrates drive functions including:<BR> *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_getdrive&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _chdrive&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_getdcwd<BR> */<BR><BR>#include &lt;stdio.h&gt;<BR>#include &lt;conio.h&gt;<BR>#include &lt;direct.h&gt;<BR>#include &lt;stdlib.h&gt;<BR>#include &lt;ctype.h&gt;<BR><BR>void main( void )<BR>{<BR>&nbsp;&nbsp; int ch, drive, curdrive;<BR>&nbsp;&nbsp; static char path[_MAX_PATH];<BR><BR>&nbsp;&nbsp; /* Save current drive. */<BR>&nbsp;&nbsp; curdrive = _getdrive();<BR><BR>&nbsp;&nbsp; printf( "Available drives are: \n" );<BR><BR>&nbsp;&nbsp; /* If we can switch to the drive, it exists. */<BR>&nbsp;&nbsp; for( drive = 1; drive &lt;= 26; drive++ )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( !_chdrive( drive ) )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf( "%c: ", drive + 'A' - 1 );<BR><BR>&nbsp;&nbsp; while( 1 )<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf( "\nType drive letter to check or ESC to quit: " );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ch = _getch();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( ch == 27 )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( isalpha( ch ) )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _putch( ch );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( _getdcwd( toupper( ch ) - 'A' + 1, path, _MAX_PATH ) != NULL )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf( "\nCurrent directory on that drive is %s\n", path );<BR>&nbsp;&nbsp; }<BR><BR>&nbsp;&nbsp; /* Restore original drive.*/<BR>&nbsp;&nbsp; _chdrive( curdrive );<BR>&nbsp;&nbsp; printf( "\n" );<BR>}<BR><BR><BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:gbh 回复日期:2003-01-17 09:17:03
<br>内容:十二分的感谢!!!!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -