暴简单的console程序怎么就不行呢?——怎么列出某一目录下的所有文件名?

Ashura Ashura 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
CString strDir;
CFileFind Finder;
BOOL bWorking;
CString strFixedFile = "*.*";
CString strFileName;

// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
printf((LPCSTR)"Please enter the directory:\n");
scanf("%s", strDir);
strDir += _T('\\');
strDir += strFixedFile;
printf((LPCSTR)strDir);
bWorking = Finder.FindFile(strDir);
while( bWorking )
{
bWorking = Finder.FindNextFile();
if ( Finder.IsDots() )
continue;
strFileName = Finder.GetFileName();
printf((LPCSTR)strFileName);
}
}

return nRetCode;
}

一个如此简单的打印某一目录下所有文件名的程序怎么就没有正确结果?
不管怎么给path,得到的总是d:盘下的一级子目录名,faint!
...全文

相关推荐

GPU Gems 3 part2

真正的GPU Gems 3,英文CHM版 第二部分

yy_yyaa

H3C WA4320瘦AP刷胖AP保姆级教程:Console线+TFTP实战

本文详细讲解H3C WA4320瘦AP通过Console线进入BootROM并使用TFTP协议刷写胖AP固件的完整流程,涵盖硬件准备、驱动安装、串口参数配置、BootROM网络设置、TFTP服务器搭建、固件选择与校验、刷写执行及验证方法,并重点分析常见故障如Console识别失败、TFTP超时、BootROM卡死等排错方案,适用于无AC环境下的独立无线组网需求。

weixin_34184561

FortiGate-60E防火墙通过Console命令重装固件v7.0.9的完整指南

本文详述通过Console接口及TFTP协议为FortiGate-60E防火墙重装FortiOS v7.0.9固件的全流程,涵盖硬件/软件准备、网络与TFTP服务器配置、Console连接参数设定(波特率9600)、TFTP传输关键步骤(端口选择、IP与文件名配置)、固件烧录与重启操作,并提供TFTP失败、登录异常等典型问题的排查要点,强调版本匹配、断电防护与默认密码安全加固。

weixin_30379531

VSCode调试神器Turbo Console Log:3分钟搞定console.log全流程(附自定义配置技巧)

本文详解VSCode插件Turbo Console Log在JavaScript调试中的应用,涵盖环境配置、核心快捷键、日志个性化定制、多语言支持(如TypeScript/React/Node.js)、项目级工程化配置、与ESLint/Prettier/Git Hooks集成方法,并提供大型项目性能优化及常见问题解决方案。

lemon

GPU Gems3 part2

图形编程人员手头必备的书,是Nvidia公司编著的GPU Gems系列的第三版,官方的介绍为:<br>GPU Gems 3 is a collection of state-of-the-art GPU programming examples. It is about putting data-parallel processing to work. The first four sections focus on graphics-specific applications of GPUs in the areas of geometry, lighting and shadows, rendering, and image effects. Topics in the fifth and sixth sections broaden the scope by providing concrete examples of nongraphical applications that can now be addressed with data-parallel GPU technology. These applications are diverse, ranging from rigid-body simulation to fluid flow simulation, from virus signature matching to encryption and decryption, and from random number generation to computation of the Gaussian.

tyxxy
评论 9
收藏 已收藏
分享
返回顶部
Ashura
VC/MFC 16,550 成员 421,606 内容