This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
funny strstream bug (yes I know it's deprecated)
- From: "Brian Bull" <b dot bull at niwa dot cri dot nz>
- To: cygwin at cygwin dot com
- Date: Fri, 11 Jan 2002 17:16:17 +1300
- Subject: funny strstream bug (yes I know it's deprecated)
People probably don't care about strstream any more but I still
thought this was an interesting one.
Self contained bug example follows:
---------------------------------------
#include <string>
#include <strstream>
int main(){
std::string fred = "
some_spaces_precede_a_single_exceedingly_long_word 1 ";
istrstream arguments((fred+" ").c_str());
std::string base;
arguments >> base;
int L;
arguments >> L;
cerr << "L " << L << '\n';
}
// Expected output: L 1
// Actual output on my system: L 0 (??!!)
----------------------------------------
Puzzlingly, the code can be made to work by replacing the words
'exceedingly long' by 'short' in std::string fred.
I'm running today's download of Cygwin and gcc on Win2000.
Any enlightenment welcome.
Yours
Brian Bull
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/