void Main::OnReadTimer( wxTimerEvent& event ){
char message [1000] = {0};
SerialReadLine(message, 1500);
char search[] = "Aktuelle Position:";
char *ptr = strstr(message, search) + strlen(search);
int pos = 0;
sscanf(ptr, "%d",&pos);
wxString tok;
tok << pos;
get_position->SetValue(tok);
}
My code crashes when I compile with sscanf. Help. Is there an altenative to sscanf? Thanks
Is sscanf compatible with wxwidgets? Topic is solved
Re: Is sscanf compatible with wxwidgets?
I don't think sscanf is the real problem in your code. First of all, you try to read up to 1500 bytes into a 1000 byte buffer. Then you don't check "ptr" for zero after the strstr() call.
Use a debugger and check where exactly it crashes.
Use a debugger and check where exactly it crashes.
Use the source, Luke!
Re: Is sscanf compatible with wxwidgets?
Thanks so much its now working.