cvs.delorie.com/djgpp/bugs/show.cgi | search |
In The Draft Standard C++ Library by P.J. Plauger, he states "For a null-terminated string s, you can write: istrstream strin(s); The character sequence begins at s and continues up to, but not including, the terminating null character that follows." From my experiments, it seems as though the terminating null character IS included in strin. Of course, this book is based on a draft copy of the standard and I believe that strstream is actually not in the standard anymore, so this may all be moot.
Obvious work around is to either to use istrstream strin(s, strlen(s)); // Or some variant. or just simply check for that null before doing a check for strin.eof().
I was wrong about the null value being added to the end of istream. It is something, but not always 0, so probably has nothing to do with that.
If at all, this is a bug in libstdc++, not in DJGPP.
webmaster | delorie software privacy |
Copyright © 2010 by DJ Delorie | Updated Jul 2010 |