octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53337] Need an option to truncate a file afte


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #53337] Need an option to truncate a file after rewriting it with shorter contents
Date: Tue, 13 Mar 2018 13:29:23 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46

URL:
  <http://savannah.gnu.org/bugs/?53337>

                 Summary: Need an option to truncate a file after rewriting it
with shorter contents
                 Project: GNU Octave
            Submitted by: philipnienhuis
            Submitted on: Tue 13 Mar 2018 06:29:22 PM CET
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Feature Request
                  Status: None
             Assigned to: None
         Originator Name: Philip Nienhuis
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

While fixing bug #53298 I stumbled upon the fact that when overwriting files
with new contents that are shorter than previous contents, trailing cruft is
preserved after the last write action.
Workarounds include overwriting the trailing cruft with spaces, or writing to
another file and renaming it afterwards. Both workarounds look overly
involved.

It would be easier if there were a way to truncate a file.

Options:

- a dedicated function, say ftrunc(), that by default truncates at the current
file pointer or accepts a position where the file should be truncated.

- an option for fclose() to truncate the file during the closing action.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53337>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]