472,789 Members | 1,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 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 1482

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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?

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.