On Mon, Jan 24, 2011 at 8:09 AM, Nelson A. de Oliveira <[email protected]> wrote:
> Here (also from your patch):
>
> snprintf (fmt_str, sizeof (fmt_str), "%%%lds %%%lds %%%lds %%%lds",
> sizeof (colorstr_r) - 1, sizeof (colorstr_g) - 1,
> sizeof (colorstr_b) - 1, sizeof (colorstr_a) - 1);
>
> sscanf (ptr, fmt_str, colorstr_r, colorstr_g, colorstr_b, colorstr_a);
FWIW, I often use an idiom like this:
----------
#include <stdio.h>
#define stringy(x) cpp2str(x)
#define cpp2str(x) #x
#define CONSTLEN 24
int main()
{
char var[CONSTLEN+1];
scanf( "%" stringy(CONSTLEN) "[^ ]s", var );
return 0;
}
----------
It's not as flexible as being able to use a sizeof() operator but I've
found it to generally be reasonable.
Chris
_______________________________________________
Gimp-developer mailing list
[email protected]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer