John,
you probably should not be reading individual lines of data from the disk.
This takes mach more time...
it is too late here to dig up the code... but here is an outline of a better
(best?) way to deal with text files:
Read_File_to_Text_Array
`$1 - pointer - to text array
`$2 - time - document reference
Repeat
insert element into array
receive packet($DocRef; $Array_ptr->{$counter}; 300megs)
if (last character is not EOL)
receive until EOL
until end of file
NOTES:
- you can check for what EOL character is by examining the first text array
element looking for whatever EOL marker you expect
- this in most cases reads the entire text file into a single text array element
- 300 megs was an empirically determined number (v13) where 4D was OK with
reading and managing too much larger and 4D got/gets unhappy
- the test for EOL in the repeat loop is to allow each text array element to
end on the end of 1 line of data - to avoid breaking a line across 2 text
elements
- this works for any size file
- it makes processing the imported data much faster - as everything is in
memory rather then reading from disk each line.
- if you do not have one written already, a text parser which keeps a numeric
counter as to where it left off is very fast an efficient for moving through
text data
if you need code for either the file reading or text parsing let me know I will
get it you.
Chip
> I have a tab delimited text file and I want to get the first row with…
>
> C_TEXT($TextValue)
> $DocRef:=Open document($IndexPath)
> RECEIVE PACKET($DocRef;$TextValue;”\r")
> CLOSE DOCUMENT($DocRef)
>
> This was working fine until about an hour ago when it suddenly
> started bringing in the whole document which has many rows. Using “\t
> ” works fine just bringing the first field in the first row.
> Any ideas?
>
> Mac OS High Sierra
> 4D v14 in Unicode mode
>
> John
>
>
> John Baughman
> Kailua, Hawaii
> (808) 262-0328
> [email protected]
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive: http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub: mailto:[email protected]
> **********************************************************************
------------
Hell is other people
Jean-Paul Sartre
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************