![]() |
![]() |
||||||
|
|||||||
| Tags: cfloop, file, point, set, start |
![]() |
|
|||
|
CF8 - I'm using cfloop to read a file, as described in the documentation:
<cfloop index = "index name" file = "absolute path and filename"> </cfloop> It's a text file; is there a way to define lines? Like start reading at line 4000? Thanks if anyone knows! |
| Sponsored Links |
|
|||
|
|
|
|||
|
Both techniques would work. I have not done much work with the new file
objects. But the difference seems to be whether the entire file is read into memory at once or only portions of it. For large files, the technique in the blog entry would be a better fit. Because it works with smaller chunks of information. I do not know if it makes a difference with smaller files. From: http://coldfused.blogspot.com/2007/0...dfusion-8.html With cfloop, you can also iterate over a part of the file by specifying "from" and "to" values. Here is an example to loop over lines between 10 and 20. <cfloop file="c:\temp\myfile.txt" index="line" from=10 to=20> <cfoutput>#line#</cfoutput> <!--- or do whatever with the line ---> </cfloop> |
|
|||
|
Since I am dealing with large files (500K+lines), I'm going to use the "from="
option. It's frustrating that this option is not in the Cold Fusion 8 "cfloop" documentation, particularly since better file handling in cfloop is one of the major new features in cf8! I wonder how many other undocumented features are out there for cold fusion? Is this the tip of the iceberg? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise