Truncate a file if it exceeds a file size

  • Thread starter Thread starter venkat
  • Start date Start date
V

venkat

Hi,

Can any one tell me the best way to truncate a file if it
exceeds a specified file size? I need to truncate the start of the file by
the appropriate amount (The data to insert). Is there any file stream
methods to do this? I should have the previous data as well, just I need to
remove a portion of data from starting of the file, if the total file size +
new data exceeds a given amount of file size.
 
You would have to read the number of bytes you want from the stream, and
then overwrite the existing file with the truncated bytes.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.
 
Back
Top