
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