reverse a file C version broken

Doug Bagley doug@bagley.org
Thu, 14 Jun 2001 07:48:49 -0500 (CDT)


Henry Cejtin wrote:
> Much  as it pains me, I must point out that the C version of `Reverse a File'
> is broken.  You can't just pass a string off to printf.  If  the  input  file
> contains  any  `%' characters, then printf will interpret them as escapes and
> will look for extra arguments, which will not be there.
> 
> The fix is to just replace the two calls  to  printf  with  calls  to  fputs,
> adding stdout as a second argument.
> 
> It  pains  me because this will speed up the C version since it won't have to
> scan the strings for printf escapes any more.

Thanks.  Pure sloppiness on my part.  (The speedup I see is only
0.01 seconds.)

Cheers,
Doug