用系统命令吧#include #include int main() { printf("当前目录下的文件数目为:"); system("dir /b /a-d | find /v /c \":::\""); }