468,537 Members | 1,555 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,537 developers. It's quick & easy.

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 1396

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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Paweł Gałecki | last post: by
2 posts views Thread by mattcarpenter | last post: by
19 posts views Thread by SU News Server | last post: by
3 posts views Thread by RHPT | last post: by
1 post views Thread by Sam Marrocco | last post: by
8 posts views Thread by gil | last post: by
2 posts views Thread by ngr | last post: by
4 posts views Thread by techusky | last post: by
3 posts views Thread by kimiraikkonen | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.