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

 

你可能感兴趣的:(IO)