Can you get a specific error condition when a C++ stream open fails?

后端 未结 2 1672
忘掉有多难
忘掉有多难 2021-01-04 07:33

Is there any way to get a specific error condition when a C++ stream open fails? That is, whether it failed because the file didn\'t exist, or permissions were wrong, or etc

2条回答
  •  醉梦人生
    2021-01-04 08:22

    In Visual Studio fopen and the like set the last-error code value. It can be retrieved with GetLastError(). The result will be one of these values.

提交回复
热议问题