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

J

johnwayne83

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
 
D

David Harmon

On 23 Nov 2006 12:52:56 -0800 in comp.lang.c++, (e-mail address removed)
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.
 
G

Gianni Mariani

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.
 
R

r

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.
 
C

Cheezefrog

thank you all for the replys i will check into what you all posted.


thank you again for the help

Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top