I have the following code:
void click(int x, int y, zbar_window_t *window, ZBarGtk *self) {
char* response = handle_click_events(x, y, window);
printf("RESPONSE + %s\n", response);
printf("%c\n", response[0]);
if (response[0] == "0") { //CRASHES HERE
printf("inside \n");
printf("%s\n", response++);
g_signal_emit(self, self->enumACTIVE, 0, -1, response++);
}
else {
g_signal_emit(self, self->enumACTIVE, 0, -1, response++);
}
}
It keeps on crashing on the stated line.
Replace this:
if(response[0] == "0")
with:
if(response[0] == '0')
"0"
is a string, '0'
is a character. You should not compare strings using ==
.
Also, you should check if response
is NULL
after this statement:
char* response = handle_click_events(x, y, window);
otherwise printf("%c\n", response[0]);
may crash again.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다