码迷,mamicode.com
首页 > 其他好文 > 详细

SIGSEGV导致的Segmentation fault

时间:2014-12-26 18:18:15      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:

code as below:

f_read = fopen("records/frame_read.ini", "r");
fclose(f_read);

 


in fact, records/frame_read.ini is not exist.

when I used gdb to debug it, appears "Program received signal SIGSEGV, Segmentation fault. 0xb7ebefc7 in flose() from /lib/i386-linux-gnu/i686/cmov/libc.so.6"

Solve it by using code as below:

f_read = fopen("records/frame_read.ini", "r");
if (f_read != NULL) fclose(f_read);

 

SIGSEGV导致的Segmentation fault

标签:

原文地址:http://www.cnblogs.com/aqing1987/p/4187052.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!