首页 文章
  • -1 votes
     answers
     views

    使用malloc和realloc动态地将字符串添加到char指针

    我正在尝试使用C中的Dirent Header文件读取目录 . 我在char数组中的给定目录中存储文件名时遇到问题 . 代码如下 . char * FileNames; while ( ( DirentPointer = readdir(DirectoryPointer) ) != NULL) { strcpy(&FileNames[Counter], DirentPointe...
  • 0 votes
     answers
     views

    <dirent.h>的新手,试图访问目录中的数据

    我之前从未使用过 dirent.h . 我使用istringstream来读取文本文件(单数),但是需要尝试修改程序以读入目录中的多个文本文件 . 这是我尝试实现dirent的地方,但它不起作用 . 也许我不能将它与stringstream一起使用?请指教 . 为了便于阅读,我做了've taken out the fluffy stuff that I' . 这对一个文件非常有效,直到我添加了...
  • 3 votes
     answers
     views

    获取目录中的文件列表

    我正在开发一个C项目,我需要获取目录中的文件列表 . 我正在使用dirent.h但是在使用它时遇到了一些问题,我正在Linux下构建程序 . 当我尝试构建程序时,我收到以下错误 myClass:error: âDIRâ undeclared (first use in this function) myClass:408: error: (Each undeclared identifier is...
  • -1 votes
     answers
     views

    C显示目录内容问题

    首先,对不起我所说的坏名称 . 这是我刚问的问题: Display files contain inside a particular directory by using C++ in LINUX 这是我所指的来源: Reading The Contents of Directories 这THREAD (C Programming)与我的输出相同 . 文件系统文件夹内容 - test.txt ...
  • 0 votes
     answers
     views

    在Windows中包含.h路径但在visual studio中的unix中省略[重复]

    这个问题在这里已有答案: How do include paths work in Visual Studio? 6个答案 我想在我的visual studio项目中包含dirent.h . 我希望兼容unix和windows . 这就是我考虑使用https://github.com/tronkko/dirent的原因 . 在该项目中,文档说: 如果您希望将dirent.h与您自己的源代码一...
  • 0 votes
     answers
     views

    c /在目录和文件上查找文档(如dirent.h)? [关闭]

    我正在寻找关于C代码的文档和目录实现到C程序的文档 . 我喜欢去cplusplus.com因为他们有文件和例子,但是我找不到dirent.h上的文档,我甚至不确定它是多么好 . 我希望有一个程序能够在目录中查看,这意味着获取其中的文件和子目录的列表,以及能够获得此类事物的修改/创建日期 . 我在Ubuntu Linux中编程 .

热门问题