Segmentation fault with strcmp
<p>I am trying to read a file and break each line into parts and when I try to do strcmp or strncmp I incur a segmentation fault. Can anyone please help me with it?</p>

<pre><code>char *input_file = argv[1];
char *line;
char *type = NULL;
ifstream infile;
infile.open(input_file, ifstream::in);
while(!infile.eof())
{
    std::string s;
    std::getline(infile, s);
    line = new char[s.length()+1];
    strcpy(line, s.c_str());
    type = strtok(line,"(");
    cout&lt;&lt;"type"&lt;&lt;type&lt;&lt;"\n";
    if(s.size()&gt;0)
        s.resize(s.size()-1);
    if(s[0]=='#')
        continue;
    if(!strncmp(type,"INPUT",5))
</code></pre>
