|
-
October 17th, 2002, 05:39 PM
#1
number of files in a directory (folder)?
How do I use straight C++ code to find out how many files in a specific directory?
Thanks,
Grace
-
October 17th, 2002, 05:54 PM
#2
There is no way to do this with ANSI C++.
You must use calls to the OS. This question will probably get more attention if you post it to the VC++ forum.
Jeff
-
October 17th, 2002, 05:59 PM
#3
There are no standard library functions to get directory information such as the number of files.
It all depends on the OS you're using. For 32-bit Windows, the FindFirstFile / FindNextFile functions are used. For UNIX, the opendir / readdir functions are used. For 16-bit DOS it is a variety, depending on the compiler you used. For other OSes, consult your OS programmer's manual.
Regards,
Paul McKenzie
-
October 17th, 2002, 06:11 PM
#4
also
There are the c run-time _findfirst and _findnext on Visual C++, again not ANSI. I think you won't find anything that is not OS specific because the ANSI standard doesn't want to assume a particular file organization system, but I would love to see a post to the contrary.
-
October 17th, 2002, 09:19 PM
#5
Thanks for all the replies. I am writing the code for the Windows platform. Do I have to loop thru all the files using FindNext or FindNextFile? Is there a count which I can simply use?
-
October 17th, 2002, 10:16 PM
#6
This isn't a windows forum. There is a CodeGuru forum available that will address your question. You'll get better help there.
Jeff
-
October 18th, 2002, 12:47 AM
#7
Originally posted by Grace
Thanks for all the replies. I am writing the code for the Windows platform. Do I have to loop thru all the files using FindNext or FindNextFile? Is there a count which I can simply use?
Take a look here
-
October 18th, 2002, 06:19 PM
#8
Seems like there is no way. Thanks all!
*^____^*
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|