Link to home
Start Free TrialLog in
Avatar of mebjen
mebjen

asked on

How To Control The Size Of A File??

Guru's,

I have a consoleApp written in VB .Net, that writes data to a text file.  What I want to accomplish is this - prior to data being written to the text file - if the file.length is over 4.5MB then we deleted 500 lines from the beginning of the file.
Could someone please show me how to trim or delete 500 lines of data from the beginning of the file in this scenario.

Thank-you

mb
ASKER CERTIFIED SOLUTION
Avatar of joepeg
joepeg

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mebjen
mebjen

ASKER

joepeg,

Your first option does indeed seem more efficient - however, the data that gets written to the file is actually appended.  So essentially what I am trying to do is create a file that gets filled from the bottom, and as it grows (when it gets to 4.5MB) data or rows start dropping off or out of the top.

Any thoughts??
What is writing the file, and what is accessing the file?
Avatar of mebjen

ASKER

StreamWriter is writing to it //