printf("Print some stuff here %d.",A,B)
I want the value of B printed but not A. Due to the nature of what I am
doing,I cannot reverse the order of A and B.
Any help would be appreciated.
Please respond to oba...@clemson.edu
Thanks,
Jason
--
****************************************************************************
* Jason Balser * "When you have eliminated the impossible, *
* oba...@clemson.edu * whatever remains, however improbable, *
>Does anyone know if there is a way to have printf "ignore" an argument in its
>argument list? As an example, is there a way to get printf to skip over the
>argument A in the following and print B:
> printf("Print some stuff here %d.",A,B)
>I want the value of B printed but not A. Due to the nature of what I am
>doing,I cannot reverse the order of A and B.
Not in C as described in the ANSI and ISO standards. The X/Open standard
(to justify the `std' in the newsgroup name :-) specifies a mechanism
for reordering the arguments of printf. It looks something like this
printf ("B=%2$d, A=%1$d.", A, B);
I think I remember that you had to use all of the arguments, though
(sorry, I don't have X/Open at hand and the HP-UX manual pages aren't a
good indication of standards conformance).
hp
>Any help would be appreciated.
>Please respond to oba...@clemson.edu
>Thanks,
>Jason
>--
> ****************************************************************************
> * Jason Balser * "When you have eliminated the impossible, *
> * oba...@clemson.edu * whatever remains, however improbable, *
--
_ | Peter Holzer | h...@vmars.tuwien.ac.at | h...@wsr.ac.at
|_|_) |------------------------------------------------------
| | | ...and it's finished! It only has to be written.
__/ | -- Karl Lehenbauer