It is a bit hard to know which thread you are answering, since you didn't
edit the subject line.
Is it about file-based configuration?
/pwm
On Sun, 4 May 2008 Geo...@ao... wrote:
> Take a look at this information from "The C Programming Language by K&R".
> Page 148.
>
> Unions may hold objects of different types and sizes, with the compiler
> keeping track of size and alignment requirements.
>
> struct {
> char *name;
> int flags;
> int utype; // Use utype to indicate what the variable type is.....
> union u_tag {
> int ival;
> float fval;
> char *sval;
> } u;
> } symtab[NSYM];
>
> the member ival is referred to as symtab[i].u.ival
> the first character of the string sval by either of *symtab[i].u.sval or
> symtab[i].u.sval[0]
>
> u is large enough to hold the largest of the three types; the specific size
> is implementation-dependent.
>
> if (utype == INT) Do Something;
> else if (utype == FLOAT) Do Something;
> else if (utype == STRING) Do Something;
> else Do Something;
>
> I typed it in fast so check it out. Hope this gives you a clue.
>
> George
>
>
>
>
>
> **************Wondering what's for Dinner Tonight? Get new twists on family
> favorites at AOL Food.
> (http://food.aol.com/dinner-tonight?NCID=aolfod00030000000001)
>
|