Nov 16, 2001 #1 marsd IS-IT--Management Apr 25, 2001 2,218 US I would like to be able to format my printing dynamically: example: for (x=10 ; x > 0 ; x--) { if (x < prev) { printf "%(x + 1)d", x } prev = x } of course this doesn't work. What is the syntax that I need for this? TIA
I would like to be able to format my printing dynamically: example: for (x=10 ; x > 0 ; x--) { if (x < prev) { printf "%(x + 1)d", x } prev = x } of course this doesn't work. What is the syntax that I need for this? TIA
Nov 16, 2001 #2 tjean IS-IT--Management Nov 16, 2001 1 US You can try: for (x=10 ; x > 0 ; x--) { if (x < prev) { Format = "%" x + 1 "d"; printf Format, x; } prev = x } The idea is to build the Format string outside of the printf command ... Upvote 0 Downvote
You can try: for (x=10 ; x > 0 ; x--) { if (x < prev) { Format = "%" x + 1 "d"; printf Format, x; } prev = x } The idea is to build the Format string outside of the printf command ...
Nov 16, 2001 Thread starter #3 marsd IS-IT--Management Apr 25, 2001 2,218 US Thanks, I'll try it. Upvote 0 Downvote