网站首页  词典首页

请输入您要查询的函数:

 

术语 getcurrentdirectory
释义 GetCurrentDirectory
语法:
C++
DWORD WINAPI GetCurrentDirectory(
__in DWORD nBufferLength,
__out LPTSTR lpBuffer
);
GetCurrentDirectory函数
获取当前进程的当前目录。
参数
nBufferLength [in]
在当前目录字符串缓冲区的长度,在TCHARs。缓冲区的长度必须包括一个终止空字符的空间。
lpBuffer [out]
一个缓冲区,接收当前目录字符串指针。这种空结尾的字符串指定的绝对路径到当前目录。
要确定所需的缓冲区大小,设置此参数为NULL和nBufferLength参数为0。
返回值
如果函数成功,返回值指定字符写入缓冲区,不包括终止空字符数。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
如果缓冲区是指向lpBuffer不够大,返回值指定字符缓冲区所需的大小,包括空终止字符。
备注
每个进程都有一个当前目录,由两部分组成:
磁盘指示符是一个驱动器号一个冒号,或服务器名称按一个共享名在其后(\\ \\服务器\\共享名)
磁盘上的指示器目录
要设置当前目录,使用SetCurrentDirectory函数。
多线程应用程序和共享库中的代码不应该使用GetCurrentDirectory职能,并应避免使用相对路径名。当前目录国家的SetCurrentDirectory函数书面存储为每个进程中的全局变量,因此,多线程应用程序不能可靠地使用数据,没有腐败的可能从其它线程这个值,也可以读取或设置此值。这种限制也适用于SetCurrentDirectory和GetFullPathName功能。唯一的例外是当应用程序保证是在一个线程中运行,例如解析命令行中的主线程参数字符串之前产生任何额外的线程文件名。多线程应用程序中使用相对路径名或共享库的代码可以产生不可预知的结果,不支持。
实例
有关示例,请参阅更改当前目录。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinBase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesGetCurrentDirectoryW(Unicode)和GetCurrentDirectoryA(ANSI)的
参见
CreateDirectory
目录管理功能
GetSystemDirectory
GetWindowsDirectory
RemoveDirectory
SetCurrentDirectory
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年9月3日
==英文原文==GetCurrentDirectory Function
Retrieves the current directory for the current process.
Syntax
C++
DWORD WINAPI GetCurrentDirectory(
__in DWORD nBufferLength,
__out LPTSTR lpBuffer
);
Parameters
nBufferLength [in]
The length of the buffer for the current directory string, in TCHARs. The buffer length must include room for a terminating null character.
lpBuffer [out]
A pointer to the buffer that receives the current directory string. This null-terminated string specifies the absolute path to the current directory.
To determine the required buffer size, set this parameter to NULL and the nBufferLength parameter to 0.
Return Value
If the function succeeds, the return value specifies the number of characters that are written to the buffer, not including the terminating null character.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
If the buffer that is pointed to by lpBuffer is not large enough, the return value specifies the required size of the buffer, in characters, including the null-terminating character.
Remarks
Each process has a single current directory that consists of two parts:
A disk designator that is either a drive letter followed by a colon, or a server name followed by a share name (\\\\servername\\sharename)
A directory on the disk designator
To set the current directory, use the SetCurrentDirectory function.
Multithreaded applications and shared library code should not use the GetCurrentDirectory function and should avoid using relative path names. The current directory state written by the SetCurrentDirectory function is stored as a global variable in each process, therefore multithreaded applications cannot reliably use this value without possible data corruption from other threads that may also be reading or setting this value. This limitation also applies to the SetCurrentDirectory and GetFullPathName functions. The exception being when the application is guaranteed to be running in a single thread, for example parsing file names from the command line argument string in the main thread prior to creating any additional threads. Using relative path names in multithreaded applications or shared library code can yield unpredictable results and is not supported.
Examples
For an example, see Changing the Current Directory .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesGetCurrentDirectoryW (Unicode) and GetCurrentDirectoryA (ANSI)
See Also
CreateDirectory
Directory Management Functions
GetSystemDirectory
GetWindowsDirectory
RemoveDirectory
SetCurrentDirectory
Send comments about this topic to Microsoft
Build date: 9/3/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa364934(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:23:44