bhe
24th April 2009, 11:48
hi all,
i'm newbie in qt, and i have to make a program in qt to read data from usb device, digital compass to be more precisely
and this is the part of my code
in .h file
private:
char buf[256];
QString line
in .cpp
while(running) {
res = read(fd, buf, 255);
if(res > 1) {
buf[res-1] = 0;
line = buf;
emit newData(line);
}
}
but when i try to run it i got message : "The program has unexpectedly finished"
when i try to comment the "emit newData(line)" with "qDebug() << line;" it'll show the data that i want.
even when i try to use mid() function on line like this "line.mid(2,5)" it'll show the same message, but not with "line.length()"
my purpose it to emit the data, and parse in other class outside this file
anybody can help me please
thanks in advance
cheers,
i'm newbie in qt, and i have to make a program in qt to read data from usb device, digital compass to be more precisely
and this is the part of my code
in .h file
private:
char buf[256];
QString line
in .cpp
while(running) {
res = read(fd, buf, 255);
if(res > 1) {
buf[res-1] = 0;
line = buf;
emit newData(line);
}
}
but when i try to run it i got message : "The program has unexpectedly finished"
when i try to comment the "emit newData(line)" with "qDebug() << line;" it'll show the data that i want.
even when i try to use mid() function on line like this "line.mid(2,5)" it'll show the same message, but not with "line.length()"
my purpose it to emit the data, and parse in other class outside this file
anybody can help me please
thanks in advance
cheers,