问题标签 [dirent.h]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
163 浏览

c++ - 如何将文件夹中的所有 img 添加到 CImage 数组元素?

我对这个问题有些麻烦;(我不知道如何将 img 添加到 CImage 数组元素。我想要像这些操作一样。↓</p>

我想将 bmp 文件添加到名为 image 的 CImage 数组中!我想也许有一些方法可以立即做到这一点。:0 我在 Google 上找到了“dirent.h”。但我不知道如何正确使用它来完成我的工作.. ;(

发生一些错误

如何修复它?;((

0 投票
1 回答
119 浏览

c - 显示目录中的文件

我有一个名为dir的目录名称。它按顺序包含以下文件

我编写了以下 C 程序来显示目录dir中的所有文件

代码 :

上面的代码给出的实际输出为

但我希望按正确的顺序输出,如下所示

当我直接看到目录中的文件时,它会以正确的顺序排列和显示文件。

那么为什么上面的C代码没有按正确的顺序读取文件,我的意思是随机读取文件。

工作环境:Linux(ubuntu12.04),gcc编译器

谢谢

0 投票
1 回答
801 浏览

c - OS X:scandir() 函数的 dirent struct 属性有问题

我正在尝试制作目录的快照,就像苹果文档中描述的那样。

我想使用scandir()功能。这是来自文档:

我不明白如何正确使用它。这是我实现快照功能的方式:

这是一个dirent struct

我不明白正确创建dirent struct以及如何在scandir()功能中正确使用它。

我从该函数中想要的只是一个数组,稍后我将它与另一个快照进行比较时可以使用它。

0 投票
2 回答
1559 浏览

ios - iOS - dirent.h - current directory name

I have written virtual system (VFS) that I am using for my apps on Windows. Now, I moved my application to iOS and I have issue with dirrent.

Windows port has added info about current folder, where file is.

How can I get that info ? DirName variable is useless, since its only relative path.

And second, on windows I specify folder to be mapped as root of my VFS. How can I do the same for iOS ? Lets say, to map VFS to directory DATA.

0 投票
0 回答
422 浏览

c++ - dirent.h 不返回所有项目

我目前正在使用 Visual Studio 9 和一些 QT 工具开发 C++ 应用程序。我的另一个版本是 1.13。我不记得我是否将这个版本与我的 VS 安装一起获得,或者我将它替换为我下载文件夹中的那个版本。

无论如何,我的应用程序正在使用下面的代码来获取我将扫描子目录的选定映射网络驱动器的用户输入。但是,下面的方法不会返回所有项目。目前只有 112 个子目录,但循环仅获取 101 个项目,包括“。” 和“..”项目。这里有人遇到过这种情况或有建议的补救措施吗?

谢谢你。

0 投票
2 回答
888 浏览

sorting - sort files by ascii order

I'm trying to code a simple function to sort the content of a directory. The Thing is, it comes out in alphabetical order, regardless of uppercase or lowercase. I'd like to sort this content in ASCII order.

example: I got 4 files, named Art, boat, Cat and donkey. My actual code sort them in this order, while i'd like to get Art, Cat, boat and donkey.

}

0 投票
2 回答
2284 浏览

c - dirent 不能使用 unicode

我尝试计算文件夹中的文件,但 readdir 函数跳过包含 unicode 字符的文件。我在 c 中使用 dirent。

0 投票
1 回答
142 浏览

c++ - 获取文件扩展名

如何改进以下代码,以便在打印文件以使用 corect 扩展示例打印 text.txt 文件时,应该打印:“test.txt”而不是这样的“test”

0 投票
1 回答
472 浏览

c - *nix - readdir64 可以在 32 位系统上使用吗?

我目前正在编写一个文件系统库,并且在readdir64()对 lib 的 *nix 端进行编码时遇到过。这个函数的文档说它需要一个dirent64*并增加了对大型文件系统的支持;这是否意味着它仅适用于 x86-64 系统?

0 投票
1 回答
1327 浏览

c++ - 在 64 位 Windows 上使用 dirent.h 编译错误

操作系统:Windows 8 64 位

编译器:Visual Studio 2012

问题描述:当我尝试用“x64”中的“dirent.h”编译代码时,出现错误。无论是否使用 dirent.h。如果代码是在“win32”设置下编译的,则不会发生该错误。

错误消息:C:\Program Files (x86)\Windows Kits\8.0\Include\um\winnt.h(146):致命错误 C1189:#error:“无目标体系结构”

例子: