23 December 2014

Background

In developing of a device remote control program, bytes are required to put in sequences according to communication protocols, defined by the manufacture.

Among those bytes, 0x00 exists. And that’s where I was trapped.

Wrong

QString str;
str.append(0x00);

By the end, str still contains nothing.

QString str;

char c = 0x00;
str.append(c);

In this way, str has one character, representing NUL in ASCII table.



blog comments powered by Disqus