listing directories and sub in C++

S

salvo

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
 
M

msalters

salvo said:
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
 
T

tarun.mohapatra

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
 
R

Ron Natalie

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.
 
I

Ioannis Vranos

Ron said:
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. :)
 
J

Jerry Coffin

Ioannis said:
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!
 
J

Jerry Coffin

Ioannis said:
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.
 
R

Ron Natalie

Ioannis said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top