reverse a file C version broken

Henry Cejtin henry@sourcelight.com
Wed, 13 Jun 2001 23:07:59 -0500


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.