Can pre-ANSI C Preprocessor handle symbolic constants in strings?

Brumley David M dlbres14 at pc.usl.edu
Thu Jun 13 01:20:07 AEST 1991


In article <RJOHNSON.91Jun10114252 at olorin.shell.com> rjohnson at shell.com (Roy Johnson) writes:
   In compensation, I illustrate your suggestion:

   char fmt[10];

   /* The first two %'s make one % in the string */
   sprintf(fmt, "%%%ds", FIELDSIZE);
   scanf(fmt, buffer);

   which is, dare I say, standard, portable, and correct?

Yes, I just can't believe you have to build the format string
dynamically with pre-ANSI compilers.
--
David M. Brumley
<dmb8516 at usl.edu>



More information about the Comp.lang.c mailing list