C++ need to use .good instead of .eof
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5605125/why-is-iostreameof-inside-a-loop-condition-considered-wrong">Why is iostream::eof inside a loop condition considered wrong?</a>  </p>
</blockquote>



<p>Hi guys I'm a total beginner and I have this function in which I use .eof however I was told that it's not a good idea since that would not work with linux and that I should use .good 
So could you tell me guys what I would do and how I should modify it</p>

<pre><code>std::string ex_file_licensing::getUsedLicense(const std::string &amp;FlexLMfileName){

        std::ofstream openFile;
        std::string line;
        std::string tempString;
        std::string testResult;
        size_t start_pos;
        size_t stop_pos;
        std::string retour ="";
        filebuf fb;
        fb.open (FlexLMfileName.c_str(),ios::in);
        istream toOpen(&amp;fb);


        if(toOpen.eof()){
            while(!toOpen.eof()){
                getline(toOpen,line);
                if(line.find("Checkout") != std::string::npos ){   
                    start_pos = line.find(":"); 
                    tempString = line.substr(start_pos+1);
                    stop_pos = tempString.find("/");
                    testResult = tempString.substr(start_pos, stop_pos);
                }
                else if (line.find("FLEXnet") != std::string::npos ){   
                    start_pos = line.find("FLEXnet"); 
                    tempString = line.substr(start_pos+1); 
                    stop_pos = tempString.find("Feature");
                    testResult = tempString.substr(start_pos, stop_pos);
                }
                cout &lt;&lt; testResult &lt;&lt; endl;
                retour.append(testResult);
            }

            fb.close();
        }

        return retour;
    }
</code></pre>

<p>Thanks guys</p>
