By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,594 Members | 3,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,594 IT Pros & Developers. It's quick & easy.

How can i scan a directory for the file names only? (new to programming)

P: n/a
This is my first semester in c++ and i took java last semester. I need
some help and i really cant find any information that has helped me or
to point me in the right direction.

I am using Visual c++ 2005 Express edition and i was wondering how to
scan a directory that the user inputs the path and the program scans
that directory and gets the file names only.

i wrote a program to copy from files and i need to scan the directory
that the user inputs to write to another file, but i cant find any
really helpfull information to help me. All my program needs is to
scan the directory and get the file names and it will be done. Any
help or links that will help me do this is C++ will be greatly
appricated.

Thank you,
Jason

Nov 23 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On 23 Nov 2006 12:52:56 -0800 in comp.lang.c++, jo*********@hotmail.com
wrote,
>I am using Visual c++ 2005 Express edition and i was wondering how to
scan a directory that the user inputs the path and the program scans
that directory and gets the file names only.
Scanning directories is system dependent and outside the standard C++
language, so you really should be asking in a microsoft group.
Use the _findfirst()/_findnext() functions and if the returned
attribute has the _A_SUBDIT bit set then skip that one. Or use the
boost/filesystem library if you want portability.

Nov 23 '06 #2

P: n/a
jo*********@hotmail.com wrote:
This is my first semester in c++ and i took java last semester. I need
some help and i really cant find any information that has helped me or
to point me in the right direction.

I am using Visual c++ 2005 Express edition and i was wondering how to
scan a directory that the user inputs the path and the program scans
that directory and gets the file names only.

i wrote a program to copy from files and i need to scan the directory
that the user inputs to write to another file, but i cant find any
really helpfull information to help me. All my program needs is to
scan the directory and get the file names and it will be done. Any
help or links that will help me do this is C++ will be greatly
appricated.
There is no C++ standard for listing contents of a directory. There are
"portable" libraries that will works across different platforms.

The "unofficial" beta of Austria C++ has one such interface - available
from :

http://netcabletv.org/public_releases/
(warning contains some precompiled binaries so it's big ~100meg).

I don't know about boost but I'd be surprised if boost didn't have a
directory listing API.
Nov 23 '06 #3

P: n/a
r

jo*********@hotmail.com wrote:
This is my first semester in c++ and i took java last semester. I need
some help and i really cant find any information that has helped me or
to point me in the right direction.

I am using Visual c++ 2005 Express edition and i was wondering how to
scan a directory that the user inputs the path and the program scans
that directory and gets the file names only.

i wrote a program to copy from files and i need to scan the directory
that the user inputs to write to another file, but i cant find any
really helpfull information to help me. All my program needs is to
scan the directory and get the file names and it will be done. Any
help or links that will help me do this is C++ will be greatly
appricated.

Thank you,
Jason
You can use the boost filesystem library.

Nov 24 '06 #4

P: n/a
You can use the boost filesystem library.

Since you said you were a beginner, here's a link:
http://www.boost.org/libs/filesystem/doc/index.htm

Nov 24 '06 #5

P: n/a
thank you all for the replys i will check into what you all posted.
thank you again for the help

Jason

Nov 25 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.