Random text string?
#9

Quote:
Originally Posted by Jefff
View Post
string[9] = random(bla bla) = crash, must be +1

pawn Code:
new
    string[11]
;
:> string[10] = EOS
No, you're wrong - we first subtract than assign so it will always have 1 less. If you print this:
pawn Code:
while(strLen--) // strLen is assigned to 10
    printf("%d", strLen);
Then you'll see that this will give
Code:
9
8
7
6
5
4
3
2
1
0
which is actually safe.
Reply


Messages In This Thread
Random text string? - by linuxthefish - 15.08.2011, 18:37
Re: Random text string? - by WoodPecker - 15.08.2011, 18:39
Re: Random text string? - by linuxthefish - 15.08.2011, 18:41
Re: Random text string? - by WoodPecker - 15.08.2011, 18:57
Re: Random text string? - by RyDeR` - 15.08.2011, 19:06
Re: Random text string? - by linuxthefish - 15.08.2011, 19:08
Re: Random text string? - by Scenario - 15.08.2011, 19:19
Re: Random text string? - by Jefff - 15.08.2011, 19:27
Re: Random text string? - by RyDeR` - 15.08.2011, 20:39
Re: Random text string? - by MadeMan - 16.08.2011, 19:08

Forum Jump:


Users browsing this thread: 1 Guest(s)