 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Janina Kramer Guest
|
Posted: Thu Aug 21, 2003 10:57 am Post subject: Portable Filesystem Library |
|
|
Hi!
I'm working on a project that has to be portable (Windows, Linux, Unix (IDE
is VisualC++) ). What I need is the list of files in a certain directory
(+subdirs), but I also need to know some file attributes like size and 'date
of last change'.
Anybody knows a lib that can do this for me?
Thanks in advance
Janina
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Thomas Richter Guest
|
Posted: Fri Aug 22, 2003 1:12 am Post subject: Re: Portable Filesystem Library |
|
|
Hi,
| Quote: | I'm working on a project that has to be portable (Windows, Linux, Unix (IDE
is VisualC++) ). What I need is the list of files in a certain directory
(+subdirs), but I also need to know some file attributes like size and 'date
of last change'.
Anybody knows a lib that can do this for me?
|
opendir() is rather portable, though it is not part of ANSI C, but
rather POSIX. Thus, you'll find it on Linux, Solaris, AIX, IRIX, HPUX
and similar, to be found in <dirent.h> in conforming systems. It is not
an ANSI-C or C++ function; these know nothing about the concept of
'directories'.
I afraid you won't get around writing your custom headers and make the
decision on a couple of #define's.
File dates can be obtained thru stat, though that's again only POSIX
and not ANSI-C/C++. Headers for stat are <sys/stat.h> and/or <unistd.h>.
So long,
Thomas
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Daniel Spangenberg Guest
|
Posted: Fri Aug 22, 2003 9:26 am Post subject: Re: Portable Filesystem Library |
|
|
Janina Kramer schrieb:
| Quote: | Hi!
I'm working on a project that has to be portable (Windows, Linux, Unix (IDE
is VisualC++) ). What I need is the list of files in a certain directory
(+subdirs), but I also need to know some file attributes like size and 'date
of last change'.
Anybody knows a lib that can do this for me?
|
I strongly recommend the filesystem library of boost. Have look at boost.
Greetings from Bremen,
Daniel Spangenberg
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
John Torjo Guest
|
Posted: Fri Aug 22, 2003 12:39 pm Post subject: Re: Portable Filesystem Library |
|
|
"Janina Kramer" <j.kramer (AT) school-sucks (DOT) com> wrote
| Quote: | Hi!
I'm working on a project that has to be portable (Windows, Linux, Unix (IDE
is VisualC++) ). What I need is the list of files in a certain directory
(+subdirs), but I also need to know some file attributes like size and 'date
of last change'.
Anybody knows a lib that can do this for me?
|
boost::filesystem ;)
www.boost.org.
Best,
John
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
max Guest
|
Posted: Fri Aug 22, 2003 12:41 pm Post subject: Re: Portable Filesystem Library |
|
|
Janina Kramer wrote:
| Quote: | Hi!
I'm working on a project that has to be portable (Windows, Linux, Unix (IDE
is VisualC++) ). What I need is the list of files in a certain directory
(+subdirs), but I also need to know some file attributes like size and 'date
of last change'.
Anybody knows a lib that can do this for me?
check your boost.org's filesystem library |
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Beman Dawes Guest
|
Posted: Sat Aug 23, 2003 2:59 am Post subject: Re: Portable Filesystem Library |
|
|
"Janina Kramer" <j.kramer (AT) school-sucks (DOT) com> wrote
| Quote: | Hi!
I'm working on a project that has to be portable (Windows, Linux, Unix (IDE
is VisualC++) ). What I need is the list of files in a certain directory
(+subdirs), but I also need to know some file attributes like size and 'date
of last change'.
Anybody knows a lib that can do this for me?
|
Look at www.boost.org/libs/filesystem.
The version in the Boost CVS has a few additional features you might
also be interested in.
--Beman Dawes
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Gennadiy Rozental Guest
|
Posted: Sat Aug 23, 2003 3:08 am Post subject: Re: Portable Filesystem Library |
|
|
| Quote: | I'm working on a project that has to be portable (Windows, Linux, Unix
(IDE
is VisualC++) ). What I need is the list of files in a certain directory
(+subdirs), but I also need to know some file attributes like size and
'date
of last change'.
Anybody knows a lib that can do this for me?
|
Boost Filesystem Library:
http://www.boost.org/libs/filesystem/doc/index.htm
Gennadiy.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Attila Feher Guest
|
Posted: Sat Aug 23, 2003 3:28 am Post subject: Re: Portable Filesystem Library |
|
|
Janina Kramer wrote:
| Quote: | Hi!
I'm working on a project that has to be portable (Windows, Linux,
Unix (IDE is VisualC++) ). What I need is the list of files in a
certain directory (+subdirs), but I also need to know some file
attributes like size and 'date of last change'.
Anybody knows a lib that can do this for me?
|
Look at the Boost filesystem library at:
http://www.boost.org/libs/filesystem/doc/index.htm
As it has been pointed out this is fairly portable (Linux/Unix/Windows/Posix
(this means in this context Mac OS X, Linux, Unix, Solaris, BSD etc.) Make
sure you read its portability guide, a link from the page I have posted.
--
Attila aka WW
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Louis Lavery Guest
|
Posted: Sat Aug 23, 2003 3:28 am Post subject: Re: Portable Filesystem Library |
|
|
Thomas Richter <thor (AT) cleopatra (DOT) math.tu-berlin.de> wrote
| Quote: | Hi,
I'm working on a project that has to be portable (Windows, Linux, Unix
(IDE
is VisualC++) ). What I need is the list of files in a certain directory
(+subdirs), but I also need to know some file attributes like size and
'date
of last change'.
Anybody knows a lib that can do this for me?
opendir() is rather portable, though it is not part of ANSI C, but
rather POSIX. Thus, you'll find it on Linux, Solaris, AIX, IRIX, HPUX
and similar, to be found in <dirent.h> in conforming systems. It is not
an ANSI-C or C++ function; these know nothing about the concept of
'directories'.
I afraid you won't get around writing your custom headers and make the
decision on a couple of #define's.
|
COBOLs! Don't use #defines, use your make file (or whatever) to select
the *.c in your platform dependent directories.
Louis.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
smitty_one_each Guest
|
Posted: Sat Aug 23, 2003 3:29 am Post subject: Re: Portable Filesystem Library |
|
|
| Quote: | I'm working on a project that has to be portable (Windows, Linux, Unix (IDE
is VisualC++) ). What I need is the list of files in a certain directory
(+subdirs), but I also need to know some file attributes like size and 'date
of last change'.
Anybody knows a lib that can do this for me?
|
http://boost.org/libs/filesystem/doc/index.htm might meet your
requirements.
But don't limit your investigation of boost to just the filesystem
library: boost has a lot to offer.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|