473,546 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3233
On 23 Nov 2006 12:52:56 -0800 in comp.lang.c++, jo*********@hot mail.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*********@hot mail.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*********@hot mail.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
2659
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 seems to be the brute force method, and I'm wondering if anyone can think of a better strategy. I've been asked to make life easy on graphic...
8
2575
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 last MOnday, files from several drirectories in alphabetical order, things like that). To represent directories and subidrectories, is it advisable...
1
4735
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 I have run into I am not sure how to fix, and really not sure what is causing it. Here's what is going on (test server - Windows 2003 Server): I...
2
5952
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 use the System.DirectoryServices.ActiveDirectory namespace. I don't even know if this is the right way to go as I can't seem to find anything in that...
12
2524
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 else has had experience with this, or knows of a different way to copy a directory using VB. I found ways to copy files, but not having a lot of...
1
1814
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 pretty sure some programs are available (backup programs) but I would like to do it myself... with help ;)
2
3190
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, "cscope -R" wouldn't scan that linked directoty. What option should I use to scan linked source directory using
3
4562
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 DirectoryInfo(folder); FileInfo fileNames = di.GetFiles("AllInput_*.xml"); Basically, I have lots of foldres under C:\INPUT\CUSTOMERS and I want to the
2
4300
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 dir1/dir2/dir3/dir4/dir5/file.txt
0
7694
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7792
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6026
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.