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

Boost.Filesystem what would you add?

Anybody looked at this stuff?

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

Most of it seems fairly straightforward. If you happen to do thing such as
put ~/code/c++/project in your path, be sure to read up on

boost::filesystem::path::default_name_check(boost: :filesystem::native);

(BTW, C++ should splat the last std::exception to console by _default_!)

IIRC Dietmar mentioned wanting to get suff like the name and filesize from
an fstream. This won't do exactly that. In particular, I don't see a way
of asking an fstream for it's filename. It does have a utility to check
the size of a file, however. You could probably build some kind of smart
file handle with all the pieces.

I'd like to see a generic stream handle that would file I/O and network I/O
uniformly.
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Aug 3 '05 #1
3 2654
Steven T. Hatton wrote:
IIRC Dietmar mentioned wanting to get suff like the name and filesize from
an fstream.
I think you remember incorrectly! I know pretty well that a file may
not be associated with any name. For example, it is not that unusual for
temporary files to be openend and immediately be removed on POSIX systems:
the file and its contents is still around, but it has no name. In addition,
POSIX files can have many names.

Likewise, I have never been interested much in file size because this is
a pretty volatile property anyway: when you have read it, it may not be
correct anymore because some other process may have written to the file.
I'd like to see a generic stream handle that would file I/O and network
I/O uniformly.


This is, IMO, the wrong way to go in a C++ context. The way to go is
to implement stream buffers for the relevant streams.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence
Aug 3 '05 #2
Dietmar Kuehl wrote:
Steven T. Hatton wrote:
IIRC Dietmar mentioned wanting to get suff like the name and filesize
from an fstream.
I think you remember incorrectly! I know pretty well that a file may
not be associated with any name. For example, it is not that unusual for
temporary files to be openend and immediately be removed on POSIX systems:
the file and its contents is still around, but it has no name. In
addition, POSIX files can have many names.


Yes. This is true. But that doesn't mean there's no value in getting a name
when it exists. I was thinking in terms of something explicitly designed
to work with named files, and files which are 'predictable'. I talking
about something that the program would assemble, not some thing you could
apply to every file descriptor to extract information from it. BTW, I'm
not sure if a file can actually have two 'real' names. I know they can be
symlinked, but you can test to see if that's really the name. It's been
quite some time since I studied the details of file systems, and I'm sure
they've changed.
Likewise, I have never been interested much in file size because this is
a pretty volatile property anyway: when you have read it, it may not be
correct anymore because some other process may have written to the file.


As for getting the file size, I thought that would be useful to allocate
space for it when you read it in. That /does/ raise some interesting
questions, such as how to find out if the file (size) has changed since you
opened it.

It seems to me move semantics could be useful here. It may actually be
what's happening in some cases already. That is, allocate a filebuf with
the size of the file, read the file in, and hand the buffer over to, say, a
vector, rather than copying the content of the buffer from one location to
another.
I'd like to see a generic stream handle that would file I/O and network
I/O uniformly.


This is, IMO, the wrong way to go in a C++ context. The way to go is
to implement stream buffers for the relevant streams.


I meant handels in the abstract. Sure, the underlying implementation is
going to vary, but there are certain concepts which apply to both reading a
file from a harddrive, and reading it from a network connection. Perhaps
you don't see that as the perview of the Standard. I know this sort of
thing is done with C++. I can point Konqueror at many different kinds of
resources (i.e., use different protocols), and get a uniform user
interface.

svn://anonsvn.kde.org/home/kde/trunk/KDE
sftp://my.secure.host/path/to/stuff
ftp://ftp.suse.com/
file://home/usrname/
smb://path/to/resource
shttp://secure.host.abc/
http://doc.trolltech.com/4.0/index.html

--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Aug 3 '05 #3
Steven T. Hatton wrote:
BTW, I'm
not sure if a file can actually have two 'real' names.
On POSIX systems files can have more than one "real" name. It is
called a "hard link". You can determine the number of current
hard links for a file (or a file descriptor) but you cannot determine
[easily] the set of names.
It seems to me move semantics could be useful here. It may actually be
what's happening in some cases already. That is, allocate a filebuf with
the size of the file, read the file in, and hand the buffer over to, say,
a vector, rather than copying the content of the buffer from one location
to another.


Stream buffers are not designed to work this way.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence
Aug 3 '05 #4

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

Similar topics

18
by: perseus | last post by:
It is really crazy! I need to use the Boost filesystem for the manipulation of directories, and I have no idea how to install this filesystem on my IBM-compatible machine. Does anyone up here know...
3
by: Michael | last post by:
Is this the correct place to ask about Boost libs? If it is.............. #include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> using namespace boost; using...
4
by: Gary Wessle | last post by:
hi I did not find any way to traverse a given directory in c++ till I found boost, not sure if there many boost(ers) out here. but this is given me some error I cannot locate a fix. thanks ...
3
by: Andreas S. | last post by:
Hi, I don't any solution any more... I have written a small tool wich uses the boost library. It compiles fine, but I can't link it. I am on a Fedora Core 6 x86_64 system. The boost library is...
2
by: soren.andersen | last post by:
Hello out there :-) I'm new to c++, coming from Java, and trying to learn the basics of the language and all that, basically just for fun. :-) So, when once I played around with c++ a bit i...
2
by: gfaraj | last post by:
Has anyone tried to use Boost.Filesystem with C++/CLI? I'm trying to get some code that worked correctly in my native application to work on my C++/CLI program. The code is in a header file in a...
1
by: Noah Roberts | last post by:
Trying to use boost::function in a C++/CLI program. Here is code: pragma once #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <vector> using namespace System;
5
by: GaryE | last post by:
Hello: I am having trouble linking a couple of files using the boost::filesystem. I am using MSVC 6.0. Here is an abbreviated version of my problem: foo.h: #ifndef __FOO_ #define...
2
by: Javier | last post by:
Hello all, I'm trying to remove a hidden file (in UNIX) using the Boost::filesystem library. This is what I have: #include <boost/filesystem/operations.hpp> namespace...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.