C:如何获取Windows目录中的文件列表? [英] C: How to obtain a list of files in Windows directory?

查看:417
本文介绍了C:如何获取Windows目录中的文件列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据RFC959标准,我试图在C(学校作业)中实现FTP服务器。



我在LIST命令中遇到问题。 RFC读取:
该命令导致列表从服务器发送到
被动DTP,如果路径名指定一个目录或其他
组文件,则服务器应该将列表中的文件
如果路径名指定了
文件,那么服务器应该发送
文件的当前信息,一个空参数意味着用户当前工作或
默认目录。



我知道有像GetCurrentDirectory这样的函数,是否有一个函数可以在MS-DOS命令中获得类似'dir'的输出提示?任何相似的东西都会有帮助。



预先感谢!

解决方案

FindFirstFile & FindNextFile 是枚举路径的API。


I am trying to implement an FTP Server in C (school assignment), according to the RFC959 standard.

I am having trouble with the LIST command. The RFC reads: "This command causes a list to be sent from the server to the passive DTP. If the pathname specifies a directory or other group of files, the server should transfer a list of files in the specified directory. If the pathname specifies a file then the server should send current information on the file. A null argument implies the user's current working or default directory."

I know that there are functions like GetCurrentDirectory, etc. Is there a function to obtain an ouput such as that of 'dir' in MS-DOS command prompt? Anything just similiar would be helpful.

Thanks in advance!

解决方案

FindFirstFile & FindNextFile are the APIs to enumerate a path.

这篇关于C:如何获取Windows目录中的文件列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆