eof()関数に問題があります。私のループは、私が読み取っているファイルの終わりを読み取っていないため、無限ループが残ります。どんな助けや洞察も大歓迎です。ありがとう
 while (!file2.eof()) {
    getline (file2, title, ','); 
    getline (file2, authorf, ',');
    getline (file2, authorl, ',');
    getline (file2, isbn, ',');
    file2 >> pages;
    file2.ignore();
    file2 >> price;
    file2.ignore();
    getline(file2, subject, ',');
    file2 >> code;
    file1.ignore();
    file2 >> rentalp;
    file2.ignore(10, '\n');
    textbook b2(title, authorf, authorl, publisher, pages, isbn, price, code, subject, rentalp);
    b2.PrintTbook();
    TbookList[j] = b2; //initalizing the first element of the array to b2.
    newFile << "Title: " << TbookList[j].getTitle() << "\n" << "Price: " << TbookList[j].getPrice() << "\n\n";
    TbookList[j].PrintBook();
    j++;
    textbookCount++;
}
テキストファイルは次のようになります。
データ構造とアルゴリズム分析の実用的な紹介、クリフォード、シャファー、0-13-028446-7、512、90.00、コンピュータサイエンス、E、12.00、2001データベースシステムの基礎、ラメズ、アルマスリ、9-780805-317558、955 、115.50、コンピュータサイエンス、E、0.0、2003