473,394 Members | 1,718 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 directories and sub in C++

Hi,

I'd like to write a platform-indipendent method that lists all the files
contained in a directory.

Where do I start from?!

Thanks in advance
Salvo
Jul 23 '05 #1
12 1499

salvo wrote:
Hi,

I'd like to write a platform-indipendent method that lists all the files contained in a directory.


Directories are platform-dependent, so this is impossible.
Regards,
Michiel Salters

Jul 23 '05 #2
salvo wrote:
Hi,

I'd like to write a platform-indipendent method that lists all the
files contained in a directory.

Where do I start from?!

Thanks in advance
Salvo


See the filesystem library at www.boost.org.

Jeff
Jul 23 '05 #3
> I'd like to write a platform-indipendent method that lists* all the
files contained in a directory.


You can go for "C" type "findfirst() and findnext() functions. I don't
know they will be platform independent or not.

Tarun

Jul 23 '05 #4
ta*************@gmail.com wrote:
I'd like to write a platform-indipendent method that lists* all the
files contained in a directory.

You can go for "C" type "findfirst() and findnext() functions. I don't
know they will be platform independent or not.

Not only are they not platform independent, I can't even imagine what
platform those are for. Niether Windows nor any UNIX variant I am
familiar with use those.
Jul 23 '05 #5
Ron Natalie wrote:
You can go for "C" type "findfirst() and findnext() functions. I don't
know they will be platform independent or not.

Not only are they not platform independent, I can't even imagine what
platform those are for. Niether Windows nor any UNIX variant I am
familiar with use those.

Those ones are Win32 APIs functions. In fact they are the 2 of the 4
(all file system) Win32 API functions that I know. :-)


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #6
Ioannis Vranos wrote:
Ron Natalie wrote:
You can go for "C" type "findfirst() and findnext() functions. I
don't know they will be platform independent or not.

Not only are they not platform independent, I can't even imagine
what platform those are for. Niether Windows nor any UNIX
variant I am familiar with use those.


Those ones are Win32 APIs functions. In fact they are the 2 of the 4
(all file system) Win32 API functions that I know. :-)


The Win32 API does not contain a function by either of those names.

They are platform independent: they don't work on any platform!

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #7
Jerry Coffin wrote:
The Win32 API does not contain a function by either of those names.

They are platform independent: they don't work on any platform!

http://msdn.microsoft.com/library/en...ndfirsti64.asp

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #8
Ioannis Vranos wrote:
Jerry Coffin wrote:
The Win32 API does not contain a function by either of those names.

They are platform independent: they don't work on any platform!


http://msdn.microsoft.com/library/en...ndfirsti64.asp

Yes..?

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #9
Jerry Coffin wrote:
http://msdn.microsoft.com/library/en...ndfirsti64.asp

Yes..?

So they do exist.


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #10

Ioannis Vranos wrote:
Jerry Coffin wrote:
The Win32 API does not contain a function by either of those names.

They are platform independent: they don't work on any platform!


http://msdn.microsoft.com/library/en...ndfirsti64.asp

That's _findfirst, intentionally with an _ to indicate it's not a
portable function.

Regards,
Michiel Salters

Jul 23 '05 #11
Ioannis Vranos wrote:
Jerry Coffin wrote:
http://msdn.microsoft.com/library/en...ndfirsti64.asp
Yes..?


So they do exist.


Look again -- and this time read more carefully. You should certainly
know by now that a C++ compiler won't ignore even the least visible
change in spelling.

Also take note that even when spelled correctly, none of these is part
of Win32 -- they're only parts of a library included with one
particular compiler that runs on Win32.

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 23 '05 #12
Ioannis Vranos wrote:
Ron Natalie wrote:
You can go for "C" type "findfirst() and findnext() functions. I don't
know they will be platform independent or not.

Not only are they not platform independent, I can't even imagine what
platform those are for. Niether Windows nor any UNIX variant I am
familiar with use those.


Those ones are Win32 APIs functions. In fact they are the 2 of the 4
(all file system) Win32 API functions that I know. :-)

Nope, they are not. The WIN32 API's are FindFirstFile and FindNext (note
the capitalization). The are also some hack wrappers to these in the MSVC
runtimes that are called _findfirst() etc... but they are NOT part of the
WIN32 API.

Jul 23 '05 #13

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

Similar topics

0
by: Paweł Gałecki | last post by:
I used following code to scan & list directory contents (including all subdirectories). It turns out that subdirectories are NOT recognized as directories when the function is called in a recursive...
2
by: mattcarpenter | last post by:
Heya, I'm in need of a way to list the directories inside of a directory using C++ and the linux C libraries. I've tried readdir() and scandir(), however those return the entire contents of a...
19
by: SU News Server | last post by:
I've struggled with this for quite a while and I'm am just not sure what is going on. I have the following code import os def buildList( directory='/Users/mkonrad' ) dirs = listing =...
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
3
by: RHPT | last post by:
I know that you can list a directories and subdirectories using the DirectoryInfo Class. However, is it possible to sort the directories by creation date? Thank you!
1
by: Sam Marrocco | last post by:
Is there a listing of the variables that can be used in vb.net installer default directories? For example: // uses three of these variables. I'd like to have a listing of any others I might...
8
by: gil | last post by:
Is it possible to prevent a browser from listing the entire contents of a folder? The site, is hosted on my ISP with the following layout- site/ "user name from ISP" pagefile (dir)...
2
by: ngr | last post by:
I used to use the DirListox control in VB6 but this is no longer supported in VB.NET. What I want to do: I want to take a directory listing and show any subdirectories in a list. When you click...
4
by: techusky | last post by:
I have a *very* simple script written that displays the directory listing of the current working directory, but I am having some difficulty when I try to change folders. Basically, I have my $dir...
3
by: kimiraikkonen | last post by:
Hi, I'd like to know whether it is possible to know the sub-directories and also files of a domain, especially domains. Does system.net provides such a function? For example: you only know...
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...
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
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
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.