SIGSEGV导致的Segmentation fault

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);

 

posted @ 2014-12-26 16:19  阿青1987  阅读(1050)  评论(0编辑  收藏  举报