📄 subject_27979.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> CString strDir;<BR> ::GetCurrentDirectory(MAX_PATH,strDir.GetBuffer(_MAX_PATH));<BR> strDir.ReleaseBuffer();<BR><BR><BR>或<BR>/* GETDRIVE.C illustrates drive functions including:<BR> * _getdrive _chdrive _getdcwd<BR> */<BR><BR>#include <stdio.h><BR>#include <conio.h><BR>#include <direct.h><BR>#include <stdlib.h><BR>#include <ctype.h><BR><BR>void main( void )<BR>{<BR> int ch, drive, curdrive;<BR> static char path[_MAX_PATH];<BR><BR> /* Save current drive. */<BR> curdrive = _getdrive();<BR><BR> printf( "Available drives are: \n" );<BR><BR> /* If we can switch to the drive, it exists. */<BR> for( drive = 1; drive <= 26; drive++ )<BR> if( !_chdrive( drive ) )<BR> printf( "%c: ", drive + 'A' - 1 );<BR><BR> while( 1 )<BR> {<BR> printf( "\nType drive letter to check or ESC to quit: " );<BR> ch = _getch();<BR> if( ch == 27 )<BR> break;<BR> if( isalpha( ch ) )<BR> _putch( ch );<BR> if( _getdcwd( toupper( ch ) - 'A' + 1, path, _MAX_PATH ) != NULL )<BR> printf( "\nCurrent directory on that drive is %s\n", path );<BR> }<BR><BR> /* Restore original drive.*/<BR> _chdrive( curdrive );<BR> 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 + -