File is not reading properly

I have a file which I am unable to read properly. This is binary file so my code is"


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<iostream>
#include<fstream>
#include<string>
using namespace std;

int main()
{
    ifstream myFile;
    myFile.open("p1",ios::binary | ios::in);

    int myInt;
    int counter=0;
    char myChar;
    while(myFile.good())
    {
        myChar=myFile.get();

        myInt=myChar;
       // cout<<counter<<":";
        cout<<(hex)<<myInt<<endl;
        counter++;

    }

}



the file to read can be download from this link :

http://sdrv.ms/166HiXA

The first content of file should be 1 I am missing few content from the begining
May be not exactly the answer to your question:

But you may read the last character of your file twice because you've forgotten to check the return value of get(). See http://www.cplusplus.com/reference/istream/basic_istream/get/.
> I am missing few content from the beginning
¿scroll?
$ ./a.out | more 
Topic archived. No new replies allowed.