Hi, when i call this funcion: char *res =(char*) bsearch(ssid, ptr, 9704447, 17, comparator); i use a comparator function.
comparator():
int comparator(const void *a, const void *b)
{
qDebug()<<"comparator()";
const char *aa = (const char *)a, *bb = (const char *)b;
qDebug()<<"1";
for (int i = 0; i < 6; ++i) {
qDebug()<<"2";
qDebug()<<"i:"<<i;
qDebug()<<"i:"<<i<<" aa:"<<aa[i]<<" bb:"<<bb[i];
qDebug()<<"3";
if (aa[i] != bb[i]) {
return aa[i] - bb[i];
}
}
return 0;
}
int comparator(const void *a, const void *b)
{
qDebug()<<"comparator()";
const char *aa = (const char *)a, *bb = (const char *)b;
qDebug()<<"1";
for (int i = 0; i < 6; ++i) {
qDebug()<<"2";
qDebug()<<"i:"<<i;
qDebug()<<"i:"<<i<<" aa:"<<aa[i]<<" bb:"<<bb[i];
qDebug()<<"3";
if (aa[i] != bb[i]) {
return aa[i] - bb[i];
}
}
return 0;
}
To copy to clipboard, switch view to plain text mode
My aplication crash, it is the debug:
Executable file: 9058 2010-10-25T01:46:47 C:\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb \meoKeyMap.exe
Package: 9380 2010-10-25T01:46:50 C:\Users\Ze\Documents\Qt\meoKeyMap\meoKeyMap.sis
Deploying application to 'Nokia E51 USB (COM4)'...
Copying installation file...
Installing application...
Starting application...
Application running with pid 875.
[Qt Message] comparator()
Process 875, thread 876 stopped at 0x7b95028c: A data abort exception has occurred.
[Qt Message] 1
[Qt Message] 2
[Qt Message] i: 0
Finished.
Bookmarks