Need some help regarding EOS
#1

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.
Reply
#2

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

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)
Reply
#4

Solved, thank you Misiur.
Reply
#5

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)