I recently needed to debug some really old legacy code, mainly designed for some microcontroller.
In this code, all printf-calls follow the same convention:
fprintf(outfile, "\r\nFormat %d", someinteger);
fflush(outfile);
You can see, the code first prints a NL (and a CR, code was written by a Win98-veteran), then the text. At the end he manually flushes the file (sometimes stdout sometimes a normal FILE*).
In my knowledge this is laborious since printing \n already flushes the handle, so the following code would be sufficient.
fprintf(outfile, "Format %d\r\n", someinteger);
Is there any reason to chose the first snippet for printing text and manually flushing the handle compared to the second snippet where the flush is implied by \n?