Hector Santos wrote:
int j = 0;
for (int i = 0; i < RR.RDlength; i++) {
int ch = RRBuffer[position+i];
if ((ch > 127) || (ch < 32)) {
continue;
}
// 255 mod check
if ((i == 0) || ((i % 255) != 0)) {
rec.szTXT[j] = ch;
j++;
}
}
This routine is incorrect because it assumes that all substrings have 255
characters which is not always the case.
Correct is (no guarantee):
int j = 0;
int n = 0; // length of substring
for (int i = 0; i < RR.RDlength; i++) {
int ch = RRBuffer[position+i];
if (--n<0) {
n = ch; // get length of substring
continue;
}
if ((ch > 127) || (ch < 32))
continue;
rec.szTXT[j] = ch;
j++;
}
Roger