getline and file handling
<p>I want to read the first lines of 2 separate files and then compare them...the following is the code i use but it gives me "istream to string error". do i need to use a while condition to start reading the files first?</p>

<pre><code>ifstream data_real(filename.c_str()); /*input streams to check if the flight info
                                     are the same*/
ifstream data_test("output_check.txt");
string read1, read2;
string first_line_input = getline(is,read1);
string first_line_output_test = getline(data_test,read2);

string test_string1, test_string2;
int num_lines_output_test, num_lines_input;
if((first_line_input.substr(0,3)==first_line_output_test.substr(0,3)))
{
    while(!data_test.eof()) // count the number of lines for the output test file with the first flight info
    {
        getline(data_test,test_string1);
        num_lines_output_test++;
    }
    while(getline(is,test_string2)) // count the number of lines for the output test file with the first flight info
    {
        if(test_string2.substr(0,3)!="ACM")
            num_lines_input++;
        else
            break;
    }
}
</code></pre>
