w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
My program is crahing, and honestly i am confused (c++)

Not likely to be your crash, but this code is terrible:

if (fnameFile.is_open())
{
    while (fnameFile.eof() == false)
    {
        plFname.resize(numFnames);
        getline(fnameFile,line);
        numFnames += 1;
    }
    fnameFile.close();
}

It doesn't check for end of file correctly, because end of file happens during getline, not before. And the line variable goes nowhere. Try

while (getline(fnameFile,line)) plFnames.push_back(line);
fnameFile.close();




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.