Enrico Forestieri wrote:

> I did that. It turned out that the compiler num_get implementation
> finishes like this:
> 
> if (__beg == __end)
> __err |= ios_base::eofbit;
> return __beg;
> 
> So, if there's nothing after the last character part of the number being
> read, the eofbit is set, invalidating the read itself!
> 
> I don't know if this is a bug (it seems so to me), but anyway...

I don't think that it is a bug: If there is nothing after the last character
you can't know whether there was an error or whether the stream was really
finished.

> Note that it would suffice appending any character not being part of
> the current numpunct facet, so the '\0' is pretty ok.

If it works... (but I would have used a space, '\0' can be surprising).


Georg

Reply via email to