Trouble with MultiMap reading in data?
<p>So the objective of this is to read in a text file that contains a number and a name which looks like this:</p>

<pre><code>50 Leonardo
20 Donatello 
100 Rapheal
40 Michelagelo
</code></pre>

<p>I was just at the point of printing it out to check it had gone in right. Instead of getting a duplicate of the text file as I expected I get the last name repeated for all the names.</p>

<p>This is what I get:</p>

<pre><code>Michelagelo 50
Michelagelo 20
Michelagelo 100
Michelagelo 100
</code></pre>

<p>The code:</p>

<pre><code>ifstream top;   
    char output[100];
    char* defaultName = "Default";
    int tempTop;
    char* tempName;


    top.open("top.txt");        
    top.clear();
    top.seekg( 0, std::ios_base::beg );


    typedef multimap &lt;char*, int&gt; MM;
    MM top;

    if (top.is_open()) {        
        while (!top.eof()){

            //Get Score
            top&gt;&gt;output;
            tempTop=atoi(output); 


            //Get Name
            top&gt;&gt;output;
            tempName=output;

         cout &lt;&lt; "Writing: " &lt;&lt; tempName &lt;&lt; " and " &lt;&lt; tempTop &lt;&lt; endl;
         top.insert(MM::value_type(tempName,tempTop));

        }
    }       

    MM::iterator i;

     for(i=top.begin(); i!=top.end(); i++){
          cout &lt;&lt; (*i).first &lt;&lt; " " &lt;&lt;  (*i).second &lt;&lt; endl;
     }
     cout &lt;&lt; "Size is: " &lt;&lt; top.size() &lt;&lt; endl;
</code></pre>

<p>My other question was that I am using this multimap as I was lead to believe it would result in a sorted list? </p>

<p>Quite confused and would appreciate the error of my newbie ways being shown to me.</p>

<p>TIA </p>
