strlen question
#1

I'm just playing with random functions when I decided to use strlen to see how it works, I have come up with a test CMD that returns the amount of characters in what I type:

pawn Код:
if(strcmp(cmd,"/test", true) == 0)
    {
        new str[128];
        new tmp[256];
        tmp = strtok(cmdtext,idx);
        format(str,sizeof(str),"There are %d characters in this string",strlen(tmp));
        SendClientMessage(playerid,0xAA3333AA,str);
        return 1;
    }
for example, if I type "/test hello" it will return "There are 5 characters in this string", the problem being if I go over 19 characters it still returns that there is only 19 characters in it.
Reply
#2

You must have somthing in the script that has a string of 19 characters, Or, It's thinking otherwise, Do you have any globals strings/variables?
Reply
#3

No, I have nothing in my script except for that one command, and strtok, which by the way I noticed in the strtok function it has:

New Result[20];

Which would be 19 cells plus the 1 null cell, I wonder if that has anything to do with it? because when I use strlen without the strtok function it can go over 19 characters.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)