Topic: std::fstream and std::string
Author: lutherbaker@yahoo.com (Luther Baker)
Date: Wed, 26 May 2004 18:00:27 +0000 (UTC) Raw View
Daniel Kr=FCgler (ne Spangenberg) wrote:
> Good morning Luther Baker,
>=20
> Luther Baker schrieb:
>=20
..
>=20
> Although that misfeature seems annoying sometimes, std::string is not=20
> directly related to a filename and would not
> reduce very much the probability of user errors. Actually much more=20
> interesting seems the standardization of a
> proper file path type (The boost::filesystem library provides an=20
> excellent ansatz with its path class), which would
> be a reasonable candidate as a valid argument of the stream classes.
>=20
> Greetings from Bremen,
>=20
Hi Daniel,
Thanks for the insight - and although I don't know what 'ansatz' is -=20
I'm guessing that you're talking about an abstract class of objects=20
(like "file") that could be used as an argument to fstream, which=20
actually does make good sense to me.
A "file" might have a path, or filename, or file::separator, etc.
Thanks,
-Luther
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: dsp@bdal.de (=?ISO-8859-1?Q?=22Daniel_Kr=FCgler_=28ne_Spangenberg=29=22?=)
Date: Thu, 27 May 2004 07:15:43 +0000 (UTC) Raw View
Luther Baker schrieb:
> Daniel Kr=FCgler (ne Spangenberg) wrote:
>
>> Good morning Luther Baker,
>>
>> Luther Baker schrieb:
>>
> ..
>
>>
>> Although that misfeature seems annoying sometimes, std::string is not=20
>> directly related to a filename and would not
>> reduce very much the probability of user errors. Actually much more=20
>> interesting seems the standardization of a
>> proper file path type (The boost::filesystem library provides an=20
>> excellent ansatz with its path class), which would
>> be a reasonable candidate as a valid argument of the stream classes.
>>
>> Greetings from Bremen,
>>
>
> Hi Daniel,
>
> Thanks for the insight - and although I don't know what 'ansatz' is -=20
> I'm guessing that you're talking about an abstract class of objects=20
> (like "file") that could be used as an argument to fstream, which=20
> actually does make good sense to me.
>
> A "file" might have a path, or filename, or file::separator, etc.
Hello Luther Baker,
Sorry for the chosen wording. I meant 'ansatz' in the sense of=20
'approach' or 'proposal'. 'Ansatz' is a scientific term
describing a method to solve a specific problem.
And yes: Boost's path class from their FileSystem library encapsulates=20
directories and files in a portable manner.
Greetings from Bremen,
Daniel
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: lutherbaker@yahoo.com (Luther Baker)
Date: Sun, 23 May 2004 00:17:41 +0000 (UTC) Raw View
I think the stl is great and I enjoy using it, but there are times when
it feels non-elegant, or inconsistent to me.
For example, why was fstream.open not written to work directly with a
std::string parameter?
-Luther
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: loic.actarus.joly@wanadoo.fr (=?ISO-8859-1?Q?Lo=EFc_Joly?=)
Date: Sun, 23 May 2004 15:33:08 +0000 (UTC) Raw View
Luther Baker wrote:
> I think the stl is great and I enjoy using it, but there are times when=
=20
> it feels non-elegant, or inconsistent to me.
>=20
> For example, why was fstream.open not written to work directly with a=20
> std::string parameter?
The cannonical explanation is to reduce dependancy between diferent=20
subparts of the SL.
While I think it would be a worthwhile goal for several external=20
libraries to have limited dependancies, I do not think this is really=20
worthwile for one library that I see as monobloc.
And I think it can be detrimental when teaching C++.
First you may have to teach .c_str() sooner that you would have expected.
Second, people, especially people who have already been exposed to C=20
before, who are reluctant to use std::string as the default choice when=20
dealing with character strings now have a good example, in the standard=20
itself, of people using char* only in a place where I do not see=20
compelling reasons to do so.
--=20
Lo=EFc
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: dsp@bdal.de (=?ISO-8859-1?Q?=22Daniel_Kr=FCgler_=28ne_Spangenberg=29=22?=)
Date: Tue, 25 May 2004 05:55:06 +0000 (UTC) Raw View
Good morning Luther Baker,
Luther Baker schrieb:
> I think the stl is great and I enjoy using it, but there are times
> when it feels non-elegant, or inconsistent to me.
>
> For example, why was fstream.open not written to work directly with a
> std::string parameter?
>
> -Luther
Although that misfeature seems annoying sometimes, std::string is not
directly related to a filename and would not
reduce very much the probability of user errors. Actually much more
interesting seems the standardization of a
proper file path type (The boost::filesystem library provides an
excellent ansatz with its path class), which would
be a reasonable candidate as a valid argument of the stream classes.
Greetings from Bremen,
Daniel
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]