Win32 相当于 opendir

发布于 2024-07-11 18:32:36 字数 113 浏览 2 评论 0原文

有人知道 opendir 的 Win32 等价物是什么(或者它是否存在)? 显然我可以将 FindFirstFile(Ex) 与 FindNextFile 一起使用,但将 * 附加到路径似乎是一种很黑客的方式。

Would anyone know what the Win32 equivalent of opendir is (or if it even exists) ?
Obviously I could use FindFirstFile(Ex) with FindNextFile, but appending * to the path seems like such a hackish way to do it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

后来的我们 2024-07-18 18:32:36

FindFirstFileFindNextFile 是适当的 Win32 API。 假设您正在编写 C++ 代码,作为一种可移植的替代方案,您可以考虑使用 Boost Filesystem 库(在 Windows 上使用 FindFirstFileFindNextFile 实现)。

FindFirstFile and FindNextFile are the appropriate Win32 APIs. Assuming you're writing C++ code, as a portable alternative you could consider using directory_iterator from the Boost Filesystem library (which is implemented on Windows using FindFirstFile and FindNextFile).

相对绾红妆 2024-07-18 18:32:36

我相信您可以使用 CreateFile FILE_FLAG_BACKUP_SEMANTICS ,然后 BackupRead 读取目录数据,但我不确定数据实际采用的格式。此外,您需要以具有 SE_BACKUP_NAME 的用户身份运行 权限已启用,因此这并不适合通用应用程序。

I believe you can use CreateFile with FILE_FLAG_BACKUP_SEMANTICS and then BackupRead to read directory data, but I'm not sure what format the data is actually in. Also, you would need to be running as a user with the SE_BACKUP_NAME privilege enabled, so this is not really suitable in a general purpose application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文