怎样用VC++遍历某一目录下的所有文件

来源:网络时间:2021-11-29 00:12:46

  #include "stdafx.h"

  #include "afx.h"

  #include "ioStream.h"

  #include "winbase.h"

  int main(int argc, char* argv[])

  {

  Dword returnValue;

  if( SetCurrentDirectory("D:CodePOS") == TRUE)

  {

  CFileFind finder;

  BOOL bWorking = finder.FindFile("*.*");

  while (bWorking)

  {

  bWorking = finder.FindNextFile();

  //cout << (LPCTSTR) finder.GetFilePath();

  cout << (LPCTSTR) finder.GetFileName() << endl;

  }

  }

  else

  {

  returnValue = GetLastError();

  };

  return 0;

  }

本文内容为用户投稿,该文观点仅代表作者本人,不代表本站立场,本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请将相关资料发送至rjfawu@163.com进行反馈与投诉,一经查实,立即处理!
多特网友2012-04-23 17:40:13回复
头文件呢?
多特网友2012-04-23 17:34:04回复
如何在vc2008中
多特网友2012-04-23 17:34:04回复
如何在vc2008中
多特网友2012-04-23 17:40:13回复
头文件呢?