weird behaviour during while(getline) ...(and std::cout?)
<p>Im getting behaviour during my while I cannot explain. For debugging I added some std::cout's.</p>

<pre><code>K_binning = new double[nbins+1];
Pi_binning = new double[nbins+1];

std::fstream filestream("data.txt",std::ios::in);
std::string row;
int iter = 0;
bool bool_K_P,bool_Pi_P;
bool_K_P = bool_Pi_P = false;   
while (getline(filestream,row,'\0')){
    std::cout &lt;&lt; " qwert" &lt;&lt; std::endl;
    std::cout &lt;&lt; row &lt;&lt; std::endl;
    std::cout &lt;&lt; " asdf" &lt;&lt; std::endl;
    if((std::string::npos != row.find("//K_P"))
    || (std::string::npos != row.find("//Pi_P"))){
        bool_K_P = (std::string::npos != row.find("//K_P"));
        bool_Pi_P = (std::string::npos != row.find("//Pi_P"));
        iter = 0; 
        std::cout &lt;&lt; " found" &lt;&lt; std::endl;
    }
    else{
       if(bool_K_P) K_binning[iter++] = atoi(row.c_str());
       if(bool_Pi_P) Pi_binning[iter++] = atoi(row.c_str());
    }
}
filestream.close();
</code></pre>

<p>When running console prints</p>

<pre><code> qwert
//K_P
...
//Pi_P
...
 asdf
found
</code></pre>

<p>At first, shouldnt it print qwert and asdf during each cycle? data.txt is just like its printed where "..." are some rows of numbers. Also binning arrays should get filled while theyre not?</p>

<p><a href="http://www.file-upload.net/download-7549005/data.txt.html" rel="nofollow">http://www.file-upload.net/download-7549005/data.txt.html</a></p>
