[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Truncate                 Truncates File at Current File Pointer

 Truncate(var F : <file type>);                                          [TP]

    Truncates a file at the current position of the file pointer. Any
    records beyond the file pointer position are removed. F must have been
    previously assigned to a disk file (using Assign) and opened for input
    or output (using Reset or Rewrite, respectively). The current file
    pointer position can be changed by using Read, Write, or Seek. After
    Truncate has been called, the file F is opened for output in Append
    mode. That is, anything written to F will then be appended to the end
    of the remaining file.

               F    Any file (text, data, or untyped).

  -------------------------------- Example ---------------------------------

           Assign(DFile,'MYSTUFF.DTA');     { open data file }
           Reset(DFile);
           Seek(DFile,100);                 { move to record #100 }
           Truncate(DFile);                 { throw the rest away }
           Close(DFile);

See Also: Append Assign Reset Rewrite Seek Read
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson