C++ Regarding strcmp and read file
<p>I got a code at main.cpp</p>

<pre><code>cout&lt;&lt;endl&lt;&lt;"Please enter filename: ";
cin.ignore();
getline(cin,fileName);
fin.open(fileName.c_str());
if(fin.is_open())
{

    while(fin.good())
    {
        fin.getline(line,20,',');

        if(!strcmp(line,"Map2D")) 
        {
            cout &lt;&lt; "Map 2D" &lt;&lt; endl;
        }
        else if(!strcmp(line,"Map3D")) 
        {
            cout &lt;&lt; "Map 3D" &lt;&lt; endl;
        }
        else if(!strcmp(line,"Dot2D")) 
        {
            cout &lt;&lt; "Dot 2D" &lt;&lt; endl;
        }
        else if(!strcmp(line,"Dot3D")) 
        {
            cout &lt;&lt; "Dot 3D" &lt;&lt; endl;
        }

    }
}
</code></pre>

<p>This is my text file</p>

<pre><code>Map2D, [3, 8]
Dot3D, [7, 12, 3], [-9, 13, 68]
Map3D, [1, 3, 8]
Dot2D, [5, 7], [3, 8]
Map2D, [6, 2]
</code></pre>

<p>But the issue is when i try to compile and run, it keep print map2D and the Map3d wont even be cout</p>

<p>is there wrong with my logic on strcmp</p>

<p><strong>Update:</strong></p>

<p>I changed to if(strstr(line,"Map2D") and its work.</p>

<p>Thanks for all help.</p>
