can anyone help me in reading the file names from a folder with a specific extention in VC++ enviroment.

thanks in advance
sachin

Recommended Answers

All 2 Replies

Have you written anything yourself on this?

We usually help you troubleshoot your code, not write it for you.

Heres a snippet in mfc for finding a file of form *.extension in directory = myDirectory

// Get a list of files
   CFileFind finder;
   BOOL finding = finder.FindFile (myDirectory + CString ("\\*.") + extension);
   
   //iterate the results
   while (finding)
    {
      finding = finder.FindNextFile();
    
      //get file path
      CString path = finder.GetFilePath());
     
      //get file title
      CString title = finder.GetFileTitle() 
    }

    //dont forget to close
    finder.Close ();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.