|
Boost : |
Subject: Re: [boost] [filesystem] basic_path::operator>> issue for paths with spaces
From: Johan Råde (rade_at_[hidden])
Date: 2008-09-22 15:19:24
Andrew James wrote:
> In the past, due to the standard's approach to treating all string extraction as ending upon encountering a space, I have tended to insert the length of the string a space and then characters.
>
> "My Name" serialized becomes "7 My Name"
>
> in >> w; // read 7
> in.ignore(); // ignore space
> in.width( w ) // minimum extraction for string
> in >> s; // extract string
>
> I like this approach better than using some "sentinel" character as there's no need to perform character by character extraction one the length is known. Not to mention a path can now have a ' ', a '"', etc....
>
> Any way you slice it, there's a problem as the serialization protocol may need to change. How will previous serialized paths be extracted?
>
> --aj
There is no problem as far as serialization is concerned.
Serialization archives have no problem with strings with spaces.
--Johan Råde
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk