Re: Undocumented "printf()" funnies
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Feb 04, 2005
- 440 views
On Fri, 04 Feb 2005 02:32:44 -0800, Alan Oxley <guest at RapidEuphoria.com> wrote: >Since you cannot use variables >within the quotes, there is no reason not to have this parsed? You can use variables or any expression, eg printf(fn,sprintf("%%0%dd",colwidth),val), or printf(fn,"%0"&sprint(colwidth)&'d',val) Suppose you have eg printf(file[i],format[i],valueset[i]). It should be perfectly legal for this to reduce to printf(1,"hello",{}). Hence there is no absolute need for the format string to contain % at all. I would agree that the format string should contain the same number of valid format qualifiers as the length of the 3rd parameter, but Rob has already stated he will not do this. If you want better error checking you'll have to wrap printf yourself. Regards, Pete