title: Reading binary file from the end
body: <p>Consider my code:</p>
  
  <pre><code>int main()
  {
      ofstream izlazni_tok("Brojevi.dat", ios::binary);
      cout&lt;&lt;"Unesi 10 brojeva: ";
      double broj;
      for(int i=0; i&lt;10; i++)
      {
          cin&gt;&gt;broj;
          izlazni_tok.write((char*)&amp;broj, sizeof(broj));
      }
      cout&lt;&lt;"Obrnuti redoslijed: ";
      ifstream ulazni_tok("Brojevi.dat", ios::binary);
      ulazni_tok.seekg(0, ios::end);
      int duzina_datoteke(ulazni_tok.tellg());
      int broj_elemenata(duzina_datoteke/sizeof(double));
      for(int i=broj_elemenata-1; i&gt;=0; i--)
      {
          ulazni_tok.seekg(i*sizeof(double));
          ulazni_tok.read((char*)&amp;broj, sizeof(broj));
          cout&lt;&lt;broj&lt;&lt;endl;
      }
      return 0;
  }
  </code></pre>
  
  <p>I am a newbie in computer programming and i have been given a task to write a programm to write a binary file where u put 10 numbers into the file and then read them from the back of the file and display them when the programm runs. For some odd reason my programm doesn't display any numbers and i don't know why. Any help is welcome. :D</p>