C Language Q & A # 10 (cont.)
- For example, printf handles it correctly, going from a single newline character in a program to a DOS line feed/carriage return. When we use fprintf though, this translation of C newline to DOS line feed/carriage return is not processed (fprintf can send output to destinations which don’t want this translation). So you have to put in the carriage return (‘\r’) explicitly:
#include <stdio.h>
main()
{
fprintf(stdprn, “Start in column one\n\r”);
fprintf(stprn, “Also start in column one\n\r”);
}
- C has some other output issues like this, e.g., puts() gives you a newline automatically, while you have to include it in printf().