I'm trying to interpret a binary file as a series of integers and read the values to a vector. However, the line ifs >> n; always returns 0 and eof is always false, the file position is not updated. If I change the type to char it works but that is not what want to achieve. How can I make the code work as I want?
int readAsNumber(const char* fileName, vector <int> &content)
{
    ifstream ifs;
    int n;
    ifs.open(fileName, ifstream::in | ifstream::binary);
    while (ifs.eof() == false)   // Never terminates 
    {
        ifs >> n;               // Always sets n = 0
        content.push_back(n);   // Saves 0
    }
    ifs.close();
    return 0;
}
