Strings doesn't work in enums
#1

Hello There,

I've a problem with strings inside enums.

when using functions like (strcat or cache_get_field and functions that writes in a string), the strings' always null.

only when using format() had worked. (according to what i've tested)

here is the code:

pawn Code:
enum enumz
{
    str1[50],
    str2[50]
};

public OnFilterScriptInit()
{
    new test[enumz];
   
    new das[50] = "HI STR1";
    new das2[50] = "HI STR2";
   
    strcat(test[str1], das); // doesn't work :x
    strcat(test[str2], das2); // doesn't work :x
   
    printf("%s || %s", das, test[str1]); // prints "HI STR1 || "
    printf("%s || %s", das2, test[str2]); // prints "HI STR2 || "
   
    printf("_______________________________");

    format(test[str1], 50, "%s", das); // works
    format(test[str2], 50, "%s", das2); // works
   
    printf("%s || %s", das, test[str1]); // prints "HI STR1 || HI STR1"
    printf("%s || %s", das2, test[str2]); // prints "HI STR2 || HI STR2"
}
Is there anything i've made done or it can't be done?

Thanks.
Reply


Messages In This Thread
Strings doesn't work in enums - by Kirollos - 05.07.2013, 19:56
Re: Strings doesn't work in enums - by Vince - 05.07.2013, 20:03
Re: Strings doesn't work in enums - by Kirollos - 05.07.2013, 20:05

Forum Jump:


Users browsing this thread: 1 Guest(s)