473,320 Members | 2,164 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,320 software developers and data experts.

Accessing Directorys

Hello,

in my Programm I get the path of a directory (e.g. c:\windows\temp [in
Windows] or \root [in Linux]). Now I want to now which files are in this
directory. I need the filenames of them and if it's possible the information
if there a subdirectorys and the name of them.

But I just know functions which are only available under Windows, but I need
some, wich works under Linux as well.

Can somebody help me?

Thanks in advance ;)
Jul 23 '05 #1
4 1235
Thomas Brendgen wrote:
Hello,

in my Programm I get the path of a directory (e.g. c:\windows\temp [in
Windows] or \root [in Linux]). Now I want to now which files are in
this directory. I need the filenames of them and if it's possible the
information if there a subdirectorys and the name of them.

But I just know functions which are only available under Windows, but
I need some, wich works under Linux as well.

Can somebody help me?


Try Boost.Filesystem:

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

it has a pretty good chance of becoming part of the standard library in a future
version of C++ (prbably with some modifications and extensions).

Jonathan
Jul 23 '05 #2
Thomas Brendgen wrote:
Hello,

in my Programm I get the path of a directory (e.g. c:\windows\temp [in
Windows] or \root [in Linux]). Now I want to now which files are in this
directory. I need the filenames of them and if it's possible the information
if there a subdirectorys and the name of them.

But I just know functions which are only available under Windows, but I need
some, wich works under Linux as well.

Can somebody help me?

Thanks in advance ;)


The C++ standard doesn't (yet) define any classes or functions for
traversing directory trees. POSIX defines a C-language interface in
dirent.h, which is available on Linux and most other *nix systems; your
C++ compiler should be able to access it. I don't know if it's
supported under Win32 or not. The dirent interface works a lot like
stdio; look up opendir(), readdir(), and scandir() for details.

Rennie
Jul 23 '05 #3

"Thomas Brendgen" <Th*************@web.de> wrote in message
news:38*************@individual.net...
Hello,

in my Programm I get the path of a directory (e.g. c:\windows\temp [in
Windows] or \root [in Linux]). Now I want to now which files are in this
directory. I need the filenames of them and if it's possible the
information if there a subdirectorys and the name of them.

But I just know functions which are only available under Windows, but I
need some, wich works under Linux as well.

Can somebody help me?

Thanks in advance ;)

I dont mean to get off subject, but why not write 2 programms, instead of 2
programms in one that is seperated by #ifdef 's ?

It seems like a lot of overhead just to say you've got it all in one file.
Jul 23 '05 #4
DHOLLINGSWORTH2 wrote:
in my Programm I get the path of a directory (e.g. c:\windows\temp [in
Windows] or \root [in Linux]). Now I want to now which files are in this
directory. I need the filenames of them and if it's possible the
information if there a subdirectorys and the name of them.

But I just know functions which are only available under Windows, but I
need some, wich works under Linux as well.

Can somebody help me?

Thanks in advance ;)

I dont mean to get off subject, but why not write 2 programms, instead of
2 programms in one that is seperated by #ifdef 's ?

It seems like a lot of overhead just to say you've got it all in one file.


Are you sure you answered to the right posting?
Jul 23 '05 #5

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

Similar topics

1
by: Amy Tseng | last post by:
Hi, I am having a problem accessing SQL Server 2000 via UNIX. I am accessing SQL Server 2000 from Solaris using Sybase Open Client (CT-Lib). Here is the error message: CT-LIBRARY error:...
5
by: Sandeep | last post by:
Hi, In the following code, I wonder how a private member of the class is being accessed. The code compiles well in Visual Studio 6.0. class Sample { private: int x; public:
6
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is...
1
by: thomas.hauser | last post by:
hello everyone, I'm trying to set the rights of a few directory's on a server (win2000-network) programmatically. How is it possible to to set the rights for users, for instance the...
3
by: prodirect | last post by:
Hi all, I hope someone can help me. I've recently created a database and wanted to put it up on an ftp sight so that multiple people could access the same tables at the same time from different...
47
by: fb | last post by:
Hi Everyone. Thanks for the help with the qudratic equation problem...I didn't think about actually doing the math...whoops. Anyway... I'm having some trouble getting the following program to...
3
by: AdamM | last post by:
Hi all, When I run my VbScript, I get the error: "ActiveX component can't create object: 'getobject'. Error 800A01AD". Any ideas what I did wrong? Here's my VBScript: dim o set...
1
by: Eirik Brattbakk | last post by:
Hi I have some problems accessing a soap service made in c# using an ATL/MFC client over SSL. I have tried both CSoapMSXMLInetClient and CSoapWininetClient as template arguments with my stub...
5
by: Daniel Corbett | last post by:
I am trying to save a file dynamically created in a webpage. I get the following headers, but cannot figure out how to save the attachment. I am basically trying to replicate what internet...
0
by: mr.code | last post by:
hi guys : i hope every one in a good mode today ... english is not my first lang for that I'm sorry for the spling mistakes .. ;) now adys i'm writing code to acssees sevral directorys and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.