Hmm, so the obvious answer ( I see the light ) is that if you use Tcl open, you need to use fconfigure to set the binary mode. The use of
ns_cpfp in this instance would require a sequence of commands like:
set ifp [open infilename r] set ofp [open outfilename w+] fconfigure $ifp -translation binary fconfigure $ofp -translation binary ns_cpfp $ifp $ofp close $ifp close $ofp
Or just use either of the following:
# using OS open with O_BINARY flag set: ns_cp infilename outfilename # or Tcl: file copy infilename outfilename
I would still go with the Tcl only solution, but my question is to what branch should I create a patch? I don't know how to check out the head, any hints?
Also, I wonder why this works sometimes. The code for
ns_cpfp hasn't changed in at least two years in this respect, it has probably always been this way.