How to use Write function of Qextserialport to send structure..??
Hii,
am facing problem in sending msg packet to another device using write function of Qextserialport.
Now my question is, can I send structure (struct msg_packet) through write function of qextserialport?? If yes how?
I have framed msg packet like this:
struct Packet{
unsigned short Msghdr = 0x0022;
unsigned short Data1 = 0x0055;
unsigned short Data2 = 0x0034;
unsigned short Data3 = 0x0023;
unsigned short Data4 = 0x0a55;
};
how to sent this using Write function??? Or I have to make use of QByteArray or QString???
Help me......
Re: How to use Write function of Qextserialport to send structure..??
Quote:
Now my question is, can I send structure (struct msg_packet) through write function of qextserialport?? If yes how?
Yes.
By serializing it in to a QByteArray, and giving that QByteArray as parameter to the write() method.