473,394 Members | 1,841 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,394 software developers and data experts.

listing files in a directory

I am trying to get a list of all files of a certain extension type on disk
to do some processing in a loop. The code needs to be portable to UNIX, so
I need to use plain C++ functionality. Does anyone know of a way to do this
?
Any URLs, code snippets, etc ? Is this even possible ?

Jul 22 '05 #1
2 19487
David Jacques wrote:

I am trying to get a list of all files of a certain extension type on disk
to do some processing in a loop. The code needs to be portable to UNIX, so
I need to use plain C++ functionality. Does anyone know of a way to do this
?
Any URLs, code snippets, etc ? Is this even possible ?


This is not possible.
Plain C++ has no functionality to access a file system so your code
will be non-portable anyway.

But there is light: boost has encapsulated file system functions
for various operating systems in a consistent way.
www.boost.org
--
Karl Heinz Buchegger
kb******@gascad.at
Jul 22 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

Try Boost's filesystem library. It most likely has the filesystem
primitives you need in the portable format you want.

http://www.boost.org/libs/filesystem/doc/index.htm

Evan

David Jacques wrote:
I am trying to get a list of all files of a certain extension type on disk
to do some processing in a loop. The code needs to be portable to UNIX, so
I need to use plain C++ functionality. Does anyone know of a way to do this
?
Any URLs, code snippets, etc ? Is this even possible ?


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBj7CXoo/Prlj9GScRAh2rAJ9wlqI4UtKQFn3oRKRDWvUHEMCrxQCfVKku
nO+tD/tCdMM3K8Ekff1rrG0=
=8Oy0
-----END PGP SIGNATURE-----
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: xEM | last post by:
I have in Apache2 (win32) aliased directory, for example: Alias /ftp/mp3/ "D:/mp3/" <Directory "D:/mp3"> .... </Directory> Address to this directory will be: http://localhost/ftp/mp3/ How...
1
by: Sims | last post by:
Hi, I have a few different templates that I want to list so my clients can see different styles that are available. So I want to offer them a drop down menu listing all the styles. But to...
7
by: Jennica Humphrey | last post by:
Hi, just as the topic says, how do I get the names of files within a directory? The examples I've seen appear to be *nix-specific. I'm using .NET but would like to avoid MFC if at all possible.
0
by: Don | last post by:
I intermittently get a runtime Compilation Error that says 'The compiler failed with error code 2000'. It appears that a DLL cannot be found in the 'temporary asp.net files' directory. The...
1
by: Shawn Mehaffie | last post by:
I have an application I want to be able to: 1) Store user specifc settings in ther "My Documents". 2) Store some information in "All Users" document directory. 3) I also want to be able to...
3
by: dougawells | last post by:
Hi - I'm hoping for help with the auto-generation of a hyperlinked listing of all files in a directory. The server I use does not auto-generate this. So, when someone comes to this directory and...
1
by: TahoeKid | last post by:
I need to modify and assemble the assembler listing files generated from the VS 2005 IDE. A test generated listing file did not assmeble 'as is'. Has anyone tried this? It seems to me the...
2
by: Mike P | last post by:
Is it possible to write some code to print to the screen a listing of all files within a directory? I want to show the path of each file on screen and enable the user to download any of the files....
2
by: Jay Garland | last post by:
How can I list 20 files in a directory and have multiple pages of 20 files? Like you see on memberlists, there's 10 pages but 20 members per page.
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:
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.