Failing to read file loaded with ifstream

前端 未结 2 1708
名媛妹妹
名媛妹妹 2021-01-23 05:34
void bot_manager_item::create_games()
{
    games.clear();
    std::ifstream paths_in(\"C:\\\\Users\\\\bill hank\\\\Documents\\\\bot_plugins\\\\directory_listing.txt\",          


        
2条回答
  •  忘掉有多难
    2021-01-23 05:39

    If paths_in.good() keeps failing then it means that some of the stream error flags are set (badbit, eofbit or failbit).

    • eofbit - end of file was reached
    • badbit - error with the stream buffer such as memory shortage or an exception inside the stream buffer is cast
    • failbit - some other error beside eof was reached

    In order to find out what happened, you need to check which errorbit is set first, and then find out more about the specific error, and what can cause it.

提交回复
热议问题