title: Struggle about binary files
body: <p>Consider I have the following code: </p>
  
  <pre><code>int main()
  {
      ofstream output("Brojevi.dat");
      for(int i=0; i&lt;=10; i++)
          output.write((char*)&amp;i, sizeof(i));
      output.flush();
      ifstream input("Brojevi.dat");
      int broj;
      while(input.read((char*)&amp;broj, sizeof(broj)))
          cout&lt;&lt;broj&lt;&lt;endl;
      input.seekg(0, ios::beg);
      while(input.read((char*)&amp;broj, sizeof(broj)))
          cout&lt;&lt;broj&lt;&lt;endl;
  }
  </code></pre>
  
  <p>When i run this programm the output are numbers from 0 to 10 only once. I wonder why dont they print out twice since i got 2 same while loops. Any idea?</p>