4

I'm trying to write a small block of code that prints out the files in a given directory. I've seen references to using the direct.h library to do this, but I cannot find any documentation whatsoever on the header file and its methods. Is this library outdated? And is there another way to list all filenames of a directory in C++?

1

2 Answers 2

6

It seems that this header functions are not designed for this task, See http://msdn.microsoft.com/en-us/library/as5kw0ze(v=vs.110).aspx

Use FindFirstFile, FindNextFile and FindClose loop like in this example code

Sign up to request clarification or add additional context in comments.

Comments

0

dirent.h is header which works cross platform. So I would recommend to use it instead of some Windows functions. On some compilers it's not included as a standart header, for example Visual Studio but you can use it.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.