SA-MP Forums Archive
how to count the string size of this? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how to count the string size of this? (/showthread.php?tid=275946)



how to count the string size of this? - Unknown123 - 11.08.2011

pawn Код:
//this is to load player info from MySQL
sscanf(string, "p<|>s[24]s[129]s[16]ddddddddddddddddddddddddddddds[30]s[30]s[30]s[30]s[30]ddddddd", String[0].......);
it the size 82?


Re: how to count the string size of this? - Macluawn - 11.08.2011

Why should you need the length of it?
It's 81 actually.


Re: how to count the string size of this? - Unknown123 - 11.08.2011

Quote:
Originally Posted by Macluawn
Посмотреть сообщение
Why should you need the length of it?
It's 81 actually.
I need the length because im trying to optimize my gm

and 81 dont i have to count with the NULL thing?
and i made a print of the string it retuned something like

Код:
Unknown123 | HASHEDpASSWORDhERE | 192.168.1.1 | INTEGER1 | INTEGER2 | INTEGER3 then so on..
is you sure it is 81? i dont know


Re: how to count the string size of this? - Macluawn - 11.08.2011

Why should you need to include the null parameter? You're not storing it anywhere.
That one parameter doesn't determine the size of the array where you're going to store returned data from mysql.


Re: how to count the string size of this? - Unknown123 - 11.08.2011

ok, summary
i got this

pawn Код:
new string[81];
sscanf(string, "p<|>s[24]s[129]s[16]ddddddddddddddddddddddddddddds[30]s[30]s[30]s[30]s[30]ddddddd", String[0].......);
mysql_query(string);
so the string size so correct now? the old string i had was over 950


Re: how to count the string size of this? - Macluawn - 11.08.2011

no.
String should contain the data you want to split, and string size should be the length of returned string.
It should be way more than 81.
If you dont want to post information about every variable or string in your mysql, then you will have to count the maximum size of string yourself. I suggest you not to share that information, so.. goodluck counting.


Re: how to count the string size of this? - Unknown123 - 11.08.2011

ok, thanks you