calculate size of file
<p>i have following  program to calculate size of file</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;
int main(){

    string line;
    ifstream myfile ("C:\\Users\\7\\Desktop\\example\\text.txt",ios::in | ios::out |ios::binary);
    if (!myfile){
        cout&lt;&lt;"cannot open file";
         exit (1);

    }

     while (!myfile.eof()){
        getline(myfile,line);
        cout&lt;&lt;line&lt;&lt;endl;

     }

     long l,m;
     l=myfile.tellg();
     myfile.seekg(0,ios::end);
     m=myfile.tellg();
     cout&lt;&lt;"size of  text file is:";
     cout&lt;&lt;(m-l)&lt;&lt;"bytes"&lt;&lt;endl;
     myfile.close();

     return 0;

}
</code></pre>

<p>for make more clarify in  text.txt  file i have wrote some copy of information from this site  <code>http://en.wikipedia.org/wiki/List_of_algorithms</code> 
but it shows me 0 bytes   and why? what is wrong?</p>
