SA-MP Forums Archive
array sizes do not match, or destination array is too small - 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)
+--- Thread: array sizes do not match, or destination array is too small (/showthread.php?tid=351714)



array sizes do not match, or destination array is too small - OleKristian95 - 17.06.2012

I am getting this error but I dont know why, any ideas?


Re: array sizes do not match, or destination array is too small - .FuneraL. - 17.06.2012

Quote:
Originally Posted by OleKristian95
View Post
I am getting this error but I dont know why, any ideas?
Post the Lines.


Re: array sizes do not match, or destination array is too small - OleKristian95 - 17.06.2012

Quote:
Originally Posted by .FuneraL.
View Post
Post the Lines.
Here's some.
9370
pawn Code:
TBuilder=strtok(templine,idx); // read off RACEBUILDER
9380
pawn Code:
TempLapper=strtok(templine,idx);
10684
pawn Code:
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
10745
pawn Code:
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);



Re: array sizes do not match, or destination array is too small - Stereotype - 17.06.2012

sorry for useless post but can u use [PAWN] tags?


Re: array sizes do not match, or destination array is too small - smeti - 17.06.2012

strtok original code new result[20]; <-- 20 cell
new tmp[128], tmp2[128], <-- 128 cell

array size do not match tmp(128 cell) not equal result (20 cell)

Use strrest in gl_common.inc.

pawn Code:
#include "../include/gl_common.inc"

//...

new tmp[128], tmp2[128], Index; tmp = strrest(params,Index), tmp2 = strrest(params,Index);



Re: array sizes do not match, or destination array is too small - OleKristian95 - 17.06.2012

Quote:
Originally Posted by smeti
View Post
strtok original code new result[20]; <-- 20 cell
new tmp[128], tmp2[128], <-- 128 cell

array size do not match tmp(128 cell) not equal result (20 cell)

Use strrest in gl_common.inc.

pawn Code:
#include "../include/gl_common.inc"

//...

new tmp[128], tmp2[128], Index; tmp = strrest(params,Index), tmp2 = strrest(params,Index);
I don't understand :S


Re: array sizes do not match, or destination array is too small - Vince - 17.06.2012

Pretty sure strtok returns only 256 size strings. Yet another reason why you should abolish this method ASAP.