ofstream exception handling

前端 未结 3 1332
梦毁少年i
梦毁少年i 2021-02-19 19:53

Deliberately I\'m having this method which writes into a file, so I tried to handle the exception of the possiblity that I\'m writing into a closed file:

void pr         


        
3条回答
  •  不要未来只要你来
    2021-02-19 20:52

    Exception of the type ios_base::failure, However note that you should have set the appropriate flag with ios::exceptions to generate the exceptions or else only internal state flags will be set for indicating the error, which is the default behavior for streams.

提交回复
热议问题