Monday, November 5, 2007

Printing % with fprintf() or printf()

It is surprising that the conventional '\' escape character does not work while printing % character to a file. So instead of using \% in the format string, the
programmer needs to use %% to print % using printf().

Eg: fprintf(fp, "%%");
printf("%%");

0 comments:

Post a Comment