ChDrive 百科内容来自于: 百度百科

C语言函数

函数简介

函数名称:_chdrive
所属库名:direct.h
函数功能:改变当前的工作驱动器
函数原型:int _chdrive( int drive );
返回值:改变驱动器成功则返回0,否则返回-1

程序示例

下面的程序示例来自MSDN
// crt_getdrive.c
// compile with: /c
// Illustrates drive functions including:
// _getdrive _chdrive _getdcwd
//
#include <stdio.h>
#include <direct.h>
#include <stdlib.h>
#include <ctype.h>
int main( void )
{
int ch, drive, curdrive;
static char path[_MAX_PATH];
// Save current drive.
curdrive = _getdrive();
printf( "Available drives are:\n" );
// If we can switch to the drive, it exists.
for( drive = 1; drive <= 26; drive++ )
{
if( !_chdrive( drive ) )
{
printf( "%c:", drive + 'A' - 1 );
if( _getdcwd( drive, path, _MAX_PATH ) != NULL )
printf( " (Current directory is %s)", path );
putchar( '\n' );
}
}
// Restore original drive.
_chdrive( curdrive );
}

VB

ChDrive 语句 改变当前的驱动器。语法ChDrive drive必要的 drive 参数是一个字符串表达式,它指定一个存在的驱动器。如果使用零长度的字符串 (""),则当前的驱动器将不会改变。如果 drive 参数中有多个字符,则 ChDrive 只会使用首字母。
$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定