Board index » jbuilder » Re: Reading from a file

Re: Reading from a file


2003-08-02 03:54:18 AM
jbuilder1
Oliver Young wrote:
Quote
[...] my app would start reading
from file before whole file was written into destination folder.
One basic idea: make your app ignore files with a specific ending (e.g.
.tmp), and make the user copy the file in using a two-step process:
first copy the file into /your/location/new-file.tmp, and once the copy
is done, rename new-file.tmp to new-file.
(Or other variations of this).
 
 

Re:Re: Reading from a file

te best way to do this is to have the file end with a trailer record, before
you read the entire file, seek to te\he end of the file and look for a
trailer record, I usually put EOF00001123
which is the end of file plus the number of records, if you seek to the end
and the EOF marker is not found then ignore the file
"Oliver Young" < XXXX@XXXXX.COM >wrote in message
Quote

I have one app that runs 24h per day, checking one folder every 30
sec.
It should import into DB file that user can copy into one folder. The
problem is that file might be even 30 MB long, so my app would start
reading
from file before whole file was written into destination folder. Is there
some workaround (to check if whole file was written)?


 

Re:Re: Reading from a file

On 8/1/2003 at 3:54:18 PM, Shankar Unni wrote:
Quote
One basic idea: make your app ignore files with a specific ending
(e.g. .tmp), and make the user copy the file in using a two-step
process: first copy the file into /your/location/new-file.tmp, and
once the copy is done, rename new-file.tmp to new-file.
Another approach along the same lines is to create the file in a
different directory on the same device as the input directory. After
the file has been created, rename it to the input directory.
--
Regards,
John McGrath [TeamB]
 

{smallsort}