Charles Khunt
Charles Khunt

Reputation: 2505

how to get file information / search directories

I'm wondering how do you do stuff like gettling file information, searching through directories/subdirectories in c++? Is there a particular library that I should be looking at?

I'm seeing stuff like this in some examples:

#include <sys/types.h>
#include <sys/stat.h>

Not sure where they came from.. Thanks!

EDIT: I'm programming in Windows btw

Upvotes: 0

Views: 2430

Answers (4)

sean e
sean e

Reputation: 11925

If you are using MFC, see CFileFind. Even if you aren't, check out its implementation (if you are using Visual Studio and have installed the MFC source).

Upvotes: 1

anon
anon

Reputation:

Standard C++ has no directory access functions. On Windows, your choice is between a cross platform library such as Boost, or use of the Windows native FindFirstFile and associated functions.

Upvotes: 0

Jason Williams
Jason Williams

Reputation: 57892

In windows you can use the Win32 API - FindFirstFile & FindNextFile for searching in folders, and various GetFileXXX calls.

See here for more info: MSDN information on file APIs

Upvotes: 4

diapir
diapir

Reputation: 3040

Boost filesystem comes to mind.

Upvotes: 5

Related Questions