sscanf vs strtok & strrest
#7

pawn Код:
new
    idx;

    for(new i; i < 1000000; i++)
    {
        Integer = strval(strtok(TESTSTRING, idx));
    }
Look at where idx was defined and look at the loop:

idx is passed as a reference parameter to strtok, meaning that after your first call to strtok it will search from a different place; whereas on the other hand sscanf is still searching from the beginning. You'd probably find after x or so loops that strtok is not getting the value you're expecting, you should reset idx to 0 after each iteration.

Is this a fair test or have I missed something?
Reply


Messages In This Thread
sscanf vs strtok & strrest - by Lenny the Cup - 08.09.2010, 15:26
Re: sscanf vs strtok & strrest - by playbox12 - 08.09.2010, 15:30
Re: sscanf vs strtok & strrest - by Lenny the Cup - 08.09.2010, 15:33
Re: sscanf vs strtok & strrest - by playbox12 - 08.09.2010, 15:44
Re: sscanf vs strtok & strrest - by Lenny the Cup - 08.09.2010, 16:03
Re: sscanf vs strtok & strrest - by Lenny the Cup - 08.09.2010, 16:26
Re: sscanf vs strtok & strrest - by Simon - 08.09.2010, 23:56
Re: sscanf vs strtok & strrest - by nemesis- - 09.09.2010, 04:23
Re: sscanf vs strtok & strrest - by Lenny the Cup - 09.09.2010, 17:28
Re: sscanf vs strtok & strrest - by Lenny the Cup - 09.09.2010, 17:33

Forum Jump:


Users browsing this thread: 3 Guest(s)