String cuts when returning?
#1

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)