chdrive.c
来自「ReactOS是一些高手根据Windows XP的内核编写出的类XP。内核实现机」· C语言 代码 · 共 46 行
C
46 行
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/crt/??????
* PURPOSE: Unknown
* PROGRAMER: Unknown
* UPDATE HISTORY:
* 25/11/05: Added license header
*/
#include <precomp.h>
/*
* @implemented
*
* _chdrive (MSVCRT.@)
*
* Change the current drive.
*
* PARAMS
* newdrive [I] Drive number to change to (1 = 'A', 2 = 'B', ...)
*
* RETURNS
* Success: 0. The current drive is set to newdrive.
* Failure: -1. errno indicates the error.
*
* NOTES
* See SetCurrentDirectoryA.
*/
int _chdrive(int newdrive)
{
WCHAR buffer[] = L"A:";
buffer[0] += newdrive - 1;
if (!SetCurrentDirectoryW( buffer ))
{
_dosmaperr(GetLastError());
if (newdrive <= 0)
{
__set_errno(EACCES);
}
return -1;
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?