Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1e962ea4b41220ed5570d223fd4b3f0c0e8b3ab1
Ticket: 1830450fffffffffffffffffffffffffffffffff
open file treats a+ as a (append)
User & Date: legolas_a20 on 2007-11-12 14:28:36
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    when opening a file, specifying "a+" as mode acts just like "a" when it comes to setting the file pointer before a puts, after a seek. Both act like "a", which, as the docs say: "Set the file pointer to the end of the file prior to each write." "A+" should, according to the docs "Set the initial access position to the end of the file."
    
    so if I open f with a+, and then do:
    
      seek $f 5
      puts -nonewline $f "qqq"
    
    the qqq should end up at file position 5. It ends up at file position 'end' instead.
    
    See the attachment for a script that reproduces this, and a workaround: using RDWR as mode works as "a+" should work. The script writes a file called test.bin, and then attempts to update the middle of it as described above (and fails to do that on my 8.4.16 on windows xp sp2), followed by doing the same thing with the workaround, on a file named test2.bin (and that does work).
    
  4. foundin changed to: "obsolete: 8.4.16"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "legolas_a20"
  10. subsystem changed to: "None"
  11. title changed to: "open file treats a+ as a (append)"
  12. type changed to: "Bug"