什么是 C++相当于 PHP 的 is_dir()?

发布于 2024-09-15 15:26:09 字数 321 浏览 3 评论 0原文

PHP 的 is_dir() 在 C++ 中的等价物是什么?

http://www.php.net/manual/en/function。 is-dir.php

bool is_dir ( 字符串 $文件名 )
告诉给定的文件名是否是一个目录。

仅在 Linux 平台上工作,您会使用什么库?

如果跨平台支持很重要,您会使用什么方法?

What is the C++ equivalent of PHP's is_dir() ?

http://www.php.net/manual/en/function.is-dir.php

bool is_dir ( string $filename )
Tells whether the given filename is a directory.

Working on a Linux platform only, what library would you use?

And what if cross-platform support mattered, what method would you use?

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

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

发布评论

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

评论(2

马蹄踏│碎落叶 2024-09-22 15:26:09

C++ 标准中没有任何内容可以处理跨平台的文件系统。对于跨平台文件系统访问,请使用 Boost Filesystem 库。

There is nothing in the C++ standard to deal with filesystems across platforms. For cross platform filesystem access, use the Boost Filesystem library.

挽清梦 2024-09-22 15:26:09

POSIX 函数 lstat(及其不太安全的朋友 stat)返回一个 struct,您可以查询该信息。提供了一个方便的宏:S_ISDIR() man 2 lstat 以获取使用信息。

Boost 还提供了文件系统 库,它提供了一组易于使用的函数,包括免费函数 is_directory()

The POSIX function lstat (and its less secure friend stat) returns a struct that you can query for that information. A convenience macro is provided: S_ISDIR() man 2 lstat for usage information.

Boost also provides the filesystem library, which provides an easy-to-use set of functions, including the free function is_directory().

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