SA-MP Forums Archive
Need some help regarding EOS - 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: Need some help regarding EOS (/showthread.php?tid=470515)



Need some help regarding EOS - AlonzoTorres - 18.10.2013

My users will enter a string (email) using a dialog. The input of this shall be stored in playerInfo[playerid][pEmail].
Now I get
Quote:

error 047: array sizes do not match, or destination array is too small

whenever I try
pawn Код:
playerInfo[playerid][pEmail] = inputtext;
So now I need to know how I can use EOS (End Of String) to fill out the empty spaces in my array with NULL (\0) so that the sizes matches. Thanks in advance.


Re: Need some help regarding EOS - EiresJason - 18.10.2013

You could just format the inputtext straight into the enum variable.
pawn Код:
format(playerInfo[playerid][pEmail],sizeof(inputtext),"%s",inputtext);



Re: Need some help regarding EOS - Misiur - 18.10.2013

Don't use format like that! It's really slow. Now, additionally you need to get the size of pEmail, because sizeof will fail you. You can use strcpy, which is macro for

pawn Код:
strcat((playerInfo[playerid][pEmail][0] = EOS, playerInfo[playerid][pEmail]), inputtext, 24);
//Or if defined
strcpy(playerInfo[playerid][pEmail], inputtext, 24);
Assuming your pEmail is defined as pEmail[24]

Also, EOS is exactly the same as '\0' (single character with value NUL)


Re: Need some help regarding EOS - AlonzoTorres - 18.10.2013

Solved, thank you Misiur.


Re: Need some help regarding EOS - Misiur - 18.10.2013

Oh, wait, I messed up. It's strcat, but you already have strcpy defined, so it will be

pawn Код:
strcpy(playerInfo[playerid][pEmail], inputtext, 24);