gpt4 book ai didi

c++,列出所有文件,Windows 上的 dirent.h

转载 作者:可可西里 更新时间:2023-11-01 13:53:57 29 4
gpt4 key购买 nike

在 C++ 中,在 Windows 上列出目录中所有文件的最佳方法是什么?

在 Linux 或 Windows 上使用 gcc(例如 MingW)这很容易通过 dirent.h 实现,但是当 dirent.h 不可用时(例如 Visual Studio)在 Windows 上执行此操作的最佳方法是什么?

我是否应该强制人们将 dirent.h 的免费实现添加到他们的 Visual Studio 中?或者我应该写一个替代代码来读取文件吗?如果是这样,最好的代码是什么?

谢谢。

最佳答案

dirent.h 是一个 POSIX header 。在 Windows 上,您使用 Find*File*() Win32 API 中的函数。

关于c++,列出所有文件,Windows 上的 dirent.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5840616/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com