سؤال

I want to know how to use gettext in C with dynamic message id in the argument.

For example,

char *var = fun();   //where fun returns char * type.

char *val = gettext(var);
هل كانت مفيدة؟

المحلول

Your code is fine, but you will of course also need to make sure that fun() returns a static string, that's going to stick around. Also val should be const char *, you cannot change the strings owned by gettext.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top