Почему эта ошибка? Завершить вызов после создания экземпляра 'std::bad_alloc' What(): std::bad_alloc [закрыто]C++

Программы на C++. Форум разработчиков
Anonymous
Почему эта ошибка? Завершить вызов после создания экземпляра 'std::bad_alloc' What(): std::bad_alloc [закрыто]

Сообщение Anonymous »

Я пытаюсь загрузить данные из файла, но возникает ошибка

Код: Выделить всё

terminate called after throwing an instance of 'std::bad_alloc'
what():  std::bad_all
Мой код выглядит так

Код: Выделить всё

#include 
#include 
#include 
#include 
#include 

using namespace std;

int main() {
vector  loading;
int line;
fstream plik;
plik.open("bin.txt", ios::in);
if(plik.good()==true) {
while(!plik.eof()) {
plik>>line;
loading.push_back(line);
}
plik.close();
}

sort(loading.begin(), loading.end());
cout

Подробнее здесь: [url]https://stackoverflow.com/questions/79168011/why-this-error-terminate-called-after-throwing-an-instance-of-stdbad-alloc[/url]

Вернуться в «C++»