473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
5 3220
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: lawrence | last post by:
2 Questions: 1.) Can anyone think of a way to speed up this function? It is terribly slow. I plan to reduce the number of directories to 3, which I guess will speed it up in the end. 2.) This...
8
by: James Owens | last post by:
I'm a relative newbie, interested in storing the information from several server directories and subdirectories in XML so that I can present it selectively using XSL (all files updated today or...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
2
by: Jim in Arizona | last post by:
My goal, somehow, is to populate a dropdownlist with all the user names in active directory. I don't even know where to begin, really. I added a reference to System.DirectoryServices so I could...
12
by: samoore33 | last post by:
I found a real nice article on how to copy a directory on MSDN. The only problem is that I can not figure out how to get the namespace Microsoft.VisualBasic.MyServices. I wanted to know if anyone...
1
by: gdubois | last post by:
Hi all! Is there an easy way to scan files on network, and find out which files are new or modified? (VS2003, C#) I am trying to create a program to help myself manage the network. I am...
2
by: sunset85 | last post by:
Hi. I'm trying to scan linked source directory using "cscope" In normal case (without linked source directory), "cscope -R " works vety well. But when linked source directory included,...
3
by: =?Utf-8?B?RGF2aWRN?= | last post by:
Hi, does anyone know if I can scan a subdirectory using wildcards? I do not see a way to do this using: string folder = @"C:\INPUT\CUSTOMERS\ID???BC.*" DirectoryInfo di = new...
2
by: Peted | last post by:
Hi i have a circumstance where a user unzips a file, with a certain layer of directories to get to a textfile. So in any directory on the HDD they may end up with something like ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.