Re: Stupid Newbie-sounding question.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Michelle wrote:
> 
> 
> bah...well..i will be (probably forever) adding variables to the
> sequence...and no...all
> of the sequences will not be "flags" that may be 0 or 1..
> As a matter of fact, some sequences may be sequences of text...
> I was trying to make it so that I never had to change the read/write
> procedures, even
> though I would be adding variables on...
> You seem to be saying that it may be impossible to do this?  That I may have
> to manually
> read/write every line, instead of making a loop?  So, that means that each
> time I add
> a new variable to the sequence, I have to also go add it to the read/write
> procedures...bah..was
> trying to get around that.
> 
> hmm..*thinking "out loud"*...this isn't the ideal way to do it..but maybe I
> could assign
> a fourth parameter to each "variable type" which is a 0 or a 1 to tell if the
> variable
> should be holding a string or just plain text...well..or even a 2 for atoms, I
> guess...although
> that I can check for

You could add a "tag" to each variable, to indicate the type:
For example, use 0 to indicate a string, -1 a flag, and 1 an integer:
Then your variables would look like:
{0,"John"}      -- var[2] is a string
{-1,{1,1,0,1}}   -- var[2] contains flags: TRUE, TRUE, FALSE, TRUE
{1,{1,2,3,4,5}} -- var[2] contains integers 1,2,3,4,5

Then your routine could pick off the "tag" and send the rest to the 
appropriate print formatting routine.
Kind of awkward, because you also have to remember to add the tag when 
the variable is created, and have to handle the data separately from the 
tag when doing anything with or to the variables - such as enter strings, 
compare strings, flags, etc. In the long run, probably more work than 
just modifying a single format string to use with a printf() statement.

Irv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu