![]() |
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|
|
|
CFX_READTEXT - read text files line by lineAn alternative to the unwieldy Cold Fusion CFFILE tag - which can only be used to read whole files - this can scan text files line-by-line, or in blocks of lines.CFX_READTEXT: [DOWNLOAD] (7K) CFX_READTEXT is a small tag written in C/C++, but it addresses a very real issue - how to economically read text files into Cold Fusion. The existing CFFILE tag in Cold Fusion will read an entire file into memory - which is not a good idea for large files, particularly if the processing is taking place on a remote server. The tag was written initially so that we could support an exact website requirement - a newletter distribution for Creativematch, one of Britain's major portals for the creative industry. We have enhanced it since then to provide optional information on the text files it encounters. You can set the tag to read in a range of lines from beginning to end, and it will also return some information on the file (such as which format it has encountered). Additionally it can be told to scan the whole file to count the total number of lines and characters in the file. (It does not default to this, as it will require extra processing time.) The text data is returned as a Cold Fusion list, with a delimiter that can be specified by the user. It would be possible to return the tag return results as a query, an enhancement that we may make in future. As it stands, too, the tag is only supported for Windows systems. Here is the supporting documentation. |