Results 1 to 5 of 5

Thread: Does anyone know how to limit the size of a file? (Resolved)

Threaded View

  1. #2
    Fanatic Member
    Join Date
    Sep 2002
    Location
    Lexington, SC
    Posts
    586
    Well off the top of my head I'd say just run a check on the file when you go to write to it.

    Example...

    VB Code:
    1. If FileLen(LogFile) > 2048 then
    2. 'Logfile = path of your logfile and 2048
    3. 'I think is approx 2 megs in bytes lol can't remember offhand.
    4. 'Do whatever you want to do with the file to keep it from getting bigger..
    5. 'One thing would be to skip the first line of the file and read in the rest and then save it
    6. 'plus the new line back into the file..
    7. 'Depends on how you save as to what line you would skip
    8. End If

    EDIT:
    Assuming your using the same log file writing process as in that link you put in your message (didn't go to it till after I posted). It seems your newest error would be the last write done so you would have to skip the first one. The thing here also is though I see it actually takes up more than one line, so you'd have to skip multiple lines.

    If you dont know how to read in and rewrite a file then post and I'll go into it tommorrow but about to go to bed so not going into it right now.
    Last edited by StevenHickerson; Oct 22nd, 2003 at 10:58 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width