Yep, there's a truncate procedure in Delphi. One of the old Pascal file-handling procedures. It doesn't look at though setting the size of a Filestream is going to do anything.
 
Regards,
Brian
----- Original Message -----
From: Ross Levis
Sent: Wednesday, October 13, 2004 9:52 PM
Subject: [DUG] truncate a disk file

I'm fairly sure it's not possible but I thought I would ask to be sure.  Is there any way to truncate a file on disk without re-writing it to a new file and deleting the old one?  Say I have a 40 meg file and I want to remove the last 128 bytes from the file.  If it's not possible, it seems rediculous that Microsoft did not provide a way to do it.  Logically, it should be possible by splitting the directory entry into 2, and deleting the 2nd entry.  Or maybe some manipulation of the file allocation table.
 
Cheers,
Ross.
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to