setproperty / getproperty and print / printf / format
#1

after reading the wiki i did following:
pawn Код:
new blabla=1000;
setproperty(0,"",blabla,"ABCDEFG");
new noob[120];
getproperty(0,"",blabla,noob);
printf("%s",noob);
it prints:
Код:
D
its ALWAYS the 4th character... he should print "ABCDEFG" but he only prints the 4th...
BUT FOLLOWING WORKS FINE:
pawn Код:
new blabla=1000;
setproperty(0,"",blabla,"ABCDEFG");
new noob[120];
getproperty(0,"",blabla,noob);
print(noob);
why? whats the diffrence between print and printf? i need to put that in a format(...), so i can't use print...
Reply
#2

getproperty gives you a packed string and you need unpack it before using (most of functions don't like packed ones, and it seems that printf() is one of them)

pawn Код:
new blabla=1000;
setproperty(0,"",blabla,"ABCDEFG");
new noob[120];
getproperty(0,"",blabla,noob);
strunpack(noob, noob);
printf("%s", noob);
Reply
#3

thx very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)