0

I am looking for a way to get the file names of files in a specific folder. I have search and many people say they use the boost.filesystem. I do not know how to include this in my c++ file/package to be able to use it, or ever how to use it. Is there a different method that might have been implemented. I am using Visual Studio for building my C++ program.

It would also need to be able to prompt the user folder specific folder/file.

  • Of course you can live without boost. Keyword FindFirstFile, FindNextFile. – deviantfan Apr 05 '14 at 23:23
  • What's your particular problems with boost? There is a pretty good documentation available, and tons of tutorials. Also it should work out of the box with MSVC, just follow the installation instructions. – πάντα ῥεῖ Apr 05 '14 at 23:23
  • @πάνταῥεῖ It doesn't work out of the box with MSVC, or at least it didn't for me. – Mo Beigi Apr 06 '14 at 00:25
  • @Mohammad So what were your problems? Failed installation? Failed compilation due to missing include paths in your project? Failed linkage due to missing library search paths, or linking against the wrong library versions (debug/multithreaded)? Failed program executon due to mssing `PATH` settings to find the boost DLLs? What was the problem, if none of these mentioned? (these problems are well covered from google research and tutorials IMHO) – πάντα ῥεῖ Apr 06 '14 at 00:31
  • @user3403720 The problem with using the OS native API for filesystem handling is portablity of your program. If you're sure you'll never have to run in a different OS environment, you can well go with FoggyDay's suggestions. – πάντα ῥεῖ Apr 06 '14 at 00:38

1 Answers1

2

One API available on almost all platforms is opendir()/readdir():

DOS programs used findfirst()/findnext()/findclose(), followed by FindFirst()/FindNext() in Win32:

Community
  • 1
  • 1
FoggyDay
  • 11,962
  • 4
  • 34
  • 48