Catch Segmentation fault in c++

前端 未结 6 1183
半阙折子戏
半阙折子戏 2020-12-09 16:42

Does a try-catch block catch segmentation fault errors?

I am reading a text file using the function given below but sometimes the file is empty and the

6条回答
  •  温柔的废话
    2020-12-09 17:12

    try to check is it catcheable with catch(...){cout<<'catched';}

    Also try this line, this way you prevent pushing wrong format points:

    if (!(ss >> a >> b)) {cout<<"wrong format"<

提交回复
热议问题