Pascal Viandier wrote:
Pascal Viandier wrote:
Is there a mechanism in GPC to pass a variable number of parameters to a Pascal procedure (and to know how many they are?).
No.
I would like to implement something like the C "sprintf()" in Pascal.
Not necessary. WriteStr is built-in already.
There is no description or example for WriteStr entry in the GPC documentation. Is it possible to make something like sprintf(s, "%04d", i) with WriteStr, i.e. with leading zeroes?
Not with WriteStr. Though you could pad with spaces (i : 4), and then replace spaces by zeros (StrReplace in stringutils.pas or your own way). FormatString should be able to do it. It doesn't yet as the current implementation is not much more than a stub (it was done in a hurry ;-). BTW, this part of FormatString is implemented in Pascal (InternalFormatString in p/rts/string2.pas), so perhaps someone who doesn't like C programming might want to help here ... Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8