packed string problem
#1

pawn Код:
new packed[4 char], unpacked[4];
strpack(packed, "test");
strunpack(unpacked, packed);
print(unpacked);
expected output:
Quote:

test

actual output:
Quote:

tes

what is the problem?

it works by this way:
pawn Код:
new packed[5 char], unpacked[5];
strpack(packed, "test");
strunpack(unpacked, packed);
print(unpacked);
printf("%c %c %c %c %c", unpacked[0], unpacked[1], unpacked[2], unpacked[3], unpacked[4]);
output:
Quote:

test
t e s t

possible bug in str(un)pack?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)