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);
原文地址:https://www.cnblogs.com/aqing1987/p/4187052.html