String cuts when returning? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: String cuts when returning? (
/showthread.php?tid=154211)
String cuts when returning? -
ziomal432 - 12.06.2010
I've got this function,
pawn Код:
implode(glue, ...) //ported from PHP
{
new RetString[256],
GetString[64],
GlueString[2],
index;
GlueString[0] = glue;
for(new i = 1, c = numargs(); i < c; i++)
{
for(;;)
{
GetString[index] = getarg(i, index);
if(GetString[index] == 0)
break;
index++;
}
strcat(RetString, GetString);
strcat(RetString, GlueString);
GetString[0] = '\0';
index = 0;
}
printf("%s", RetString); //just little debug
return RetString;
}
and
pawn Код:
print(implode(',', "123", "742", "638", "532", "167"));
Console shows
Quote:
[21:49:10] 123,742,638,532,167, <- showed by debug (in end of function)
[21:49:10] 167, <- returned
|
Is it because of stupidness of PAWN?