vendredi 10 février 2017

vector subscript out of range line: 1140

Vote count: 0

I want to read from a bmp file and put the bytes in a vector until the end of file but i get the run time error: Vector Subscript Out Of range:

vector <int> data;
ifstream img_file("untitled.bmp");
if (!img_file.is_open())
{
    cout<< "can not open the file"<<endl;
    return 0;
}
while(img_file != NULL)
{
    read_byte=img_file.get();
    data.push_back(read_byte);
}

Can anyone help me?

asked 41 secs ago

Let's block ads! (Why?)



vector subscript out of range line: 1140

Aucun commentaire:

Enregistrer un commentaire