mrquicuong
25th November 2011, 03:34
Hi there,
My project uses QtDesigner to create a GUI for Kit Mini2440. It has a Line edit box to receive texts from user and send them via UART. All project was built without error and downloaded to the Mini2440 successfully.
But, when I press SEND button to send texts in this box "Line edit", I got the message "[name of project] was terminated due to application error (11)".
This is my code to change get text and send them:
I use library "terminos.h" for UART
QString text="";
text=text_setspeed->text(); //text_setspeed is the name of the Line edit
write(fd,text.latin1(),text.length());
// But if I code like this, it has no error:
QString text="abc";
write(fd,text.latin1(),text.length());
I guess I has problem when change type of variable from Qstring >> char * by "text.latin1()". Because the function write() is defined as: write(fd, data, n_bytes);
with char *data and int n_bytes.
Ps: I attached my project.7128
Thank you in advance.
My project uses QtDesigner to create a GUI for Kit Mini2440. It has a Line edit box to receive texts from user and send them via UART. All project was built without error and downloaded to the Mini2440 successfully.
But, when I press SEND button to send texts in this box "Line edit", I got the message "[name of project] was terminated due to application error (11)".
This is my code to change get text and send them:
I use library "terminos.h" for UART
QString text="";
text=text_setspeed->text(); //text_setspeed is the name of the Line edit
write(fd,text.latin1(),text.length());
// But if I code like this, it has no error:
QString text="abc";
write(fd,text.latin1(),text.length());
I guess I has problem when change type of variable from Qstring >> char * by "text.latin1()". Because the function write() is defined as: write(fd, data, n_bytes);
with char *data and int n_bytes.
Ps: I attached my project.7128
Thank you in advance.