阅读背景:

使用Stat和OpenDir()/ ReadDir()列出C语言中的当前目录和文件类型(Dir,Reg,Lnk)

来源:互联网 

Hello and thanks for reading.

您好,感谢您的阅读。

I am trying to build a program in C which is run in the Linux Shell, that accepts an argument (directory) and lists all the files in that directory, as well as whether they are a regular file, link file or directory. I need to use OpenDir()/ReadDir() and stat. Here is my code so far: (I'm a bit stuck) at the moment it only reads a file and outputs the type. How do I allow my program to read ALL files in a directory, and output their name AND what type of file they are?I




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: