Re: File writes in a loop
- From: AdemusPrime@xxxxxxxxx
- Date: Mon, 19 May 2008 10:00:04 -0700 (PDT)
Here the un-vague version of the question.
I have a 112 GB log file. I need to parse out this very large file to
smaller files. We've decided for business reasons to parse it by
date. I won't know the date, which is the name of the output file,
until after I read the record in the log. The records are supposed to
be in date order but this is NOT guaranteed. When I read a record I
then open the output file for writing. If I already have the output
file open I don't want to close it and then re-open it. The preceived
performance hit of closing and opening the same file thousands of
times doesn't make sense.
My original design was to do the following...
Open Log
Loop
Read Record
Open/Create Ouput
Write Record
Next
Close Log
All this works fine until it does the Open/Create Output on the second
interation. I was hoping to learn of a way to check if the file is
already open and wrap the Open/Create in a conditional statement.
The dictionary suggestions seem like a good solution for mulitple open
files. I will give this a try.
Thanks for the help.
.
- Follow-Ups:
- Re: File writes in a loop
- From: parez
- Re: File writes in a loop
- References:
- File writes in a loop
- From: AdemusPrime
- File writes in a loop
- Prev by Date: Re: Reflection
- Next by Date: Re: What is Parial class ?
- Previous by thread: Re: File writes in a loop
- Next by thread: Re: File writes in a loop
- Index(es):
Relevant Pages
|