>>I'm not sure how you would do this except with low-level file access. In this situation, there is nothing to APPEND into. Maybe I'll try converting my FoxPro code into C sometime and make a DLL out of it to see if that would be any faster.
>>
>Johathan,
>
>I can prepare a Header (string), I can strtran each line of text (if number of records less than 65000, I can use alines() for this)), also strtofile, filetostr. This is just an idea...
Either way, there is some low level file i/o to be done. The current approach stull operates at the record level; I wouldn't expect any significant speed gain as long as we stay at this level. What I was originally proposing was:
a) create the header as a string
b) measure the .txt file as it is, and assume it has total_length/(record_length+2) records
c) create the .dbf file containing the header with the assumed length already updated in it
d) append the whole .txt file, ignoring the crlfs.
To do this, we need to add a filler field to the original table structure, so the CRs will actually be the content of this field, and we need to assume that LFs will behave fine as delete marks. Even if they don't, we can always wrap the use of this table with "Set deleted off" thus ignoring this mark.
The gain would be that at no point we ever get down to the record level, we operate with the mockup header and the whole file at once. This still needs to create a completely new copy of the file (when adding the header), but it doesn't involve any buffering etc, and can probably be done in one bulk copy.