473,419 Members | 1,577 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,419 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 3221
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 ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
1
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...
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.