delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/02/13:31:34

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <218F3B0E5BBBD511899300B0D0F90F30013469A1@mail.ansoft.com>
From: Silqun Leung <SLeung AT ansoft DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: Issue with stringstream class
Date: Thu, 2 Jan 2003 13:29:22 -0500
MIME-Version: 1.0

Hello,
    I am having some difficulty with the stringstream class.  Here is a
simple program I run:
 
#include <sstream>
#include <iostream>
#include <string>
 
int main(int argc, char* argv[])
{
 std::string temp;
 
 std::string stuff = "asdf asdf asdf asdf asdf";  std::stringstream a;
 
 a << stuff.c_str();
 std::cout << a.str() << std::endl;
 
 a >> temp;
 std::cout << a.str();
 
 return 0;
}
 
The output when built with g++ is:
asdf asdf asdf asdf asdf
asdf asdf asdf asdf asdf
 
This is not what I expect when using the >> operator.  I looked at the
stringstream class and do not see it overloading the >> operator and believe
that it should be inheriting from the same place as the ifstream class. When
I use the >> operator on a std::ifstream object, it is destructive, however
this does not appear to be the case for the stringstream object (which I
believe it should be).  Using the same program with Visual C++ will yield
correct results (ie. an output of asdf asdf asdf asdf asdf asdf asdf asdf
asdf
 
Is this a bug in the implementation of the stringstream class?
 
Thanks,
Silqun

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019