0
点赞
收藏
分享

微信扫一扫

terminate called after throwing an instance of 'std::length_error

茗越 2023-09-06 阅读 11


主要原因:对一个空指针进行操作。

例如:

char* p = NULL:
 string str(p);              //运行时报错
 
     FILE* install_log = fopen_path(install_file, "w");
     if (install_log) {
         fputs(path, install_log);
         fputc('\n', install_log);
     } else {
         LOGE("failed to open last_install: %s\n", strerror(errno));
     }
     fclose(install_log); return;

举报

相关推荐

0 条评论