This code with strmid correct?
#1

Hello,,

In my orgs enum i have got fColor which is a string, the string is only 10 characters long... And i have got a command in which i use sscanf which i use the change the value of fColor...but the variable i save my new Color with in the command is larger than 10 Characters, so it wont let me use
pawn Код:
orgsStats[orgID][fColor] = Value;
because Value is a larger string than fColor...

so i have tried this:
pawn Код:
strmid(orgStats[user][fColor], value, 0, 9);
it seems to of compiled, will it work okay?
Reply
#2

use
pawn Код:
strcat(orgStats[user][fColor], value);
Reply
#3

Would both of these work though?

and thanks!
Reply
#4

That will only work if 'orgsStats[orgID][fColor]' is null because strcat merges two strings into one string.

pawn Код:
orgsStats[orgID][fColor] = "lemon";
value = "cake";
strcat(orgStats[user][fColor], value); // orgsStats[orgID][fColor] now is 'lemoncake'
Reply
#5

So i should use my original one, yeah? It shuld replace the string...
Reply
#6

so he must clear the array
pawn Код:
orgStats[user][fColor]="";
strcat(orgStats[user][fColor], value);
strmid works too btw
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)