printf problem: "%1$s" not handled?

Fergus Henderson fjh@cs.mu.OZ.AU
Mon Apr 20 18:19:00 GMT 1998


On 19-Apr-1998, Richard H. Gumpertz <rhg@cps.com> wrote:
> Christopher Lee <leec@mag.com>:
> > I'm having trouble on gnu-win32-b19.1 with the printf/sprintf functions.
> > Basically, positional parameters don't seem to be working:
...
> >   printf("<%1$s> <%2$s> <%3$s> <%4$s>\n","one","two","three","four");
...
> > Any way to fix this?  e.g. to replace printf/sprintf in B19.1 with ANSI
> > versions?
> 
> What is the '$' in your control strings?  I've never seen that in printf
> control strings.  Is that the source of your problem?  Is it some sort of
> local extension?

`$' for positional paramters in printf() format strings is not part of
the ANSI C standard, and if I recall correctly, it is not supported by
POSIX either.  It is however part of the X/Open standard, I think.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: < http://www.cs.mu.oz.au/~fjh >  |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3        |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list