    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>Linux.com :: Strange STL behavior</title>
        <link>http://www.linux.com/archive/forums/topic/1509</link>
        <description>Everything Linux and Open Source</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Linux.com Admin</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.linux.com" /> 
        <admin:errorReportsTo rdf:resource="mailto:noreply@linux.com" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>



<div class="xarbb-noteswrapper">
</div>

   <div class="xarbb-noteswrapper">
       <div class="xar-sub rightnote">
           <div>
                    <a href="http://www.linux.com/archive/forums/topic/1466">
Previous Topic</a>
|
                    <a href="http://www.linux.com/archive/forums/topic/1474">
Next Topic</a>
</div>

           <div>
                    <a href="http://www.linux.com/archive/forums/printtopic/1509?theme=print">
Print this topic</a> |
You are not subscribed            </div>
        </div>
        <div style="clear: both;"></div>
    </div>

    <h1>
        <a class="xar-title" href="http://www.linux.com/archive/forums/topic/1509">Strange STL behavior</a>
   </h1>


   <div class="xarbb-topiccontrols">
<form action="http://www.linux.com/archive/forums?func=jump" method="post">
   <label for="xarbb_jump_menu">Forum Jump</label>
    <select name="f" id="xarbb_jump_menu" onchange="this.form.submit();">
        <optgroup label="Options">
            <option value="5" selected="selected">
Please select forum            </option>
            <option value="5">--------------------</option>
        </optgroup>
        <optgroup label="Forums">
                <option value="1">New to Linux</option>
                <option value="2">Hardware</option>
                <option value="3">Linux Distributions</option>
                <option value="4">Applications</option>
                <option value="5">Programming and Development</option>
                <option value="6">Miscellaneous Discussion</option>
                <option value="7">Linux.com Writers Forum</option>
                <option value="8">Jobs</option>
        </optgroup>
    </select>
    <input type="submit" class="button" value="Jump" />
</form>
<div style="clear: both;"></div>
   </div>

   <div class="xarbb-topiccontrols">

<span class="xar-sub">
    <a href="http://www.linux.com/archive/forums">
Forum Index    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/category/4181">
        Forums 
    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/forum/5">
        Programming and Development   </a>
</span>
<div style="clear: both;"></div>
   </div>

<div class="xarbb-tablewrapper">



   <table>
       <tr>
           <th scope="col">
Author</th>
           <th scope="col">
Message</th>
       </tr>



            <tr>
                <td class="xar-norm author">
                    <div>
                        <a href="http://www.linux.com/archive/roles/401498">jdallen83</a>
                   </div>
                   <div class="xar-sub">
Joined: Apr 13, 2008<br/>Posts: 3                        <br />
                        <a href="http://www.linux.com/archive/forums?by=401498&amp;func=searchtopics">
Other Topics</a>
                   </div>
               </td>

               <td class="xar-norm message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted Apr 14, 2008 at 6:42:16 PM</span>
                       </div>



<div style="float: left;">
                           <strong class="xar-sub">
Subject: Strange STL behavior                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div>
                        Hi All,

I'm working on an old linux machine, which I don't have root access to. I've updated gcc and binutils to something more modern, gcc 4.1.2, binutils 2.17. glibc is 2.2.2, so pretty old.

I've noticed that istringstream 's don't work properly. Say the istringstream contains a few numbers, &quot;3.5 10.2 72.0&quot; . I can only read in one of the numbers. After the first number is read, the istringstream is invalidated! Anyone know what could be causing this?? I know my g++ is somewhat working, because pair 's work just fine, and they didn't work with the older version of gcc on this machine (2.9.6).

Here's my test program, and the output I see.


#include &lt;string&gt;
#include &lt;iostream&gt;
#include &lt;sstream&gt;

using namespace std;

int main (int argc, char* argv)
{
  string A_String;
  pair&lt;double,double&gt; A_Pair;

  A_String=&quot;20.9 33.4&quot;;

  istringstream A_ISS(A_String,ios::in);

  cout &lt;&lt; &quot;A_String: &quot; &lt;&lt; A_String &lt;&lt; endl;
  cout &lt;&lt; &quot;A_ISS: &quot; &lt;&lt; A_ISS &lt;&lt; endl;
  cout &lt;&lt; &quot;A_ISS.str(): &quot; &lt;&lt; A_ISS.str() &lt;&lt; endl;


  A_ISS &gt;&gt; A_Pair.first;

  cout &lt;&lt; &quot;A_ISS After ReadA: &quot; &lt;&lt; A_ISS &lt;&lt; endl;
  cout &lt;&lt; &quot;A_ISS.str() After ReadA: &quot; &lt;&lt; A_ISS.str() &lt;&lt; endl;

  A_ISS &gt;&gt; A_Pair.second;

  cout &lt;&lt; &quot;A_ISS After ReadB: &quot; &lt;&lt; A_ISS &lt;&lt; endl;
  cout &lt;&lt; &quot;A_ISS.str() After ReadB: &quot; &lt;&lt; A_ISS.str() &lt;&lt; endl;

  cout &lt;&lt; &quot;A and B: &quot; &lt;&lt; A_Pair.first &lt;&lt; &quot;\t&quot; &lt;&lt; A_Pair.second &lt;&lt; endl;

  return 0;
}



And the output


A_String: 20.9 33.4
A_ISS: 0xbfffe808
A_ISS.str(): 20.9 33.4
A_ISS After ReadA: 0xbfffe808
A_ISS.str() After ReadA: 20.9 33.4
A_ISS After ReadB: 0
A_ISS.str() After ReadB: 20.9 33.4
A and B: 20.9   0


Any ideas as to what is wrong???

Thanks,
Jeff</div>

                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/1509#top">
Back to top</a>
</td>
               <td class="xar-alt">

                        <a href="http://www.linux.com/archive/roles/401498">
                            <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                        </a>
                        <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=401498">
                            <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                       </a>
                            <a href="http://">
                                <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                           </a>
</td>
           </tr>





           <tr>
               <td class="xar-norm author">
                   <strong>

                            <a href="http://www.linux.com/archive/roles/401498">
                                jdallen83                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Apr 13, 2008<br/>Posts: 3<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=401498&amp;func=searchtopics">
Other Topics                        </a>
                    </span>
                </td>

                <td class="xar-accent message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Apr 14, 2008 7:11:25 PM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1187569" href="http://www.linux.com/archive/forums/topic/1509#1187569">
                                    Strange STL behavior                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        Follow up,

I believe this is due to something wrong with libc.so.6 . I found a copy of libc-2.2.4 (From GLIBC 2.2.4, rather than 2.2.2) and, using that instead of libc-2.2.2 makes it work! So, now I just need to upgrade to GLIBC 2.2.4 without destroying everything, right?

Thanks                    </div>
                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/1509#top">
Back to top</a>
</td>

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/401498">
                                <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                            </a>
                            <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=401498">
                                <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                           </a>
                                <a href="http://">
                                    <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                               </a>
</td>
           </tr>

           <tr>
               <td class="xar-norm author">
                   <strong>

                            <a href="http://www.linux.com/archive/roles/400849">
                                proopnarine                           </a>
</strong>

                   <span class="xar-sub">
<br />
<br />
Joined Apr 03, 2008<br/>Posts: 590<br />
Location:San Francisco<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=400849&amp;func=searchtopics">
Other Topics                        </a>
                    </span>
                </td>

                <td class="xar-norm message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Apr 15, 2008 3:36:24 AM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1187613" href="http://www.linux.com/archive/forums/topic/1509#1187613">
                                    Strange STL behavior                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        That's interesting! I was just about to suggest some sort of pointer problem (not being a big STL string user) when I read your follow-up. Might be worth dropping the gcc folks a note about this.<p class="hiddensignature">
<p>Take the red pill</p>
<p><a href="http://www.calacademy.org/blogs">Climate Change Blog</a></p>
<a href="http://proopnarine.wordpress.com">Food Weblog</a></p>
                    </div>
                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/1509#top">
Back to top</a>
</td>

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/400849">
                                <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                            </a>
                            <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=400849">
                                <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                           </a>
                                <a href="http://zeus.calacademy.org/roopnarine/peter.html">
                                    <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                               </a>
</td>
           </tr>
</table>
</div>

<div class="xarbb-topiccontrols">

<span class="xar-sub">
    <a href="http://www.linux.com/archive/forums">
Forum Index    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/category/4181">
        Forums 
    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/forum/5">
        Programming and Development   </a>
</span>

</div>



            </channel>
</rss>
