Adobe Dreamweaver Forums



Last 10 THreads :         Web-tier compiler is not for production use (Last Post : puja mantri - Replies : 0 - Views : 1 )           »          call function, pass value, access variable in movieclipclass from main stage (Last Post : Joergen N - Replies : 1 - Views : 2 )           »          div tags (Last Post : malcster2 - Replies : 4 - Views : 5 )           »          Rate My Site Please (Last Post : Ian Edwards - Replies : 4 - Views : 5 )           »          Do you use Java Faces with Flex? (Last Post : SujitG - Replies : 1 - Views : 2 )           »          textinput highlight problem (Last Post : SujitG - Replies : 1 - Views : 2 )           »          flex version (Last Post : SujitG - Replies : 1 - Views : 2 )           »          WebHelp Compile Won't Display (Last Post : Colum McAndrew - Replies : 20 - Views : 21 )           »          Placing an image in each column in ColumnChart (Last Post : SujitG - Replies : 1 - Views : 2 )           »          AdvancedDataGrid Select All Rows (Last Post : Milo[HUN] - Replies : 1 - Views : 35 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Cold Fusion
 
Tags: , , , ,



Reply
  #1 (permalink)  
Old 08-28-2008, 09:41 PM
phamm
 
Posts: n/a
Diggs:
Default cfloop over a file - set start point?

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!



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-28-2008, 09:56 PM
phamm
 
Posts: n/a
Diggs:
Default Re: cfloop over a file - set start point?

I think I found the answer here.

http://coldfused.blogspot.com/2007/0...dfusion-8.html
Reply With Quote
  #3 (permalink)  
Old 08-29-2008, 01:33 AM
Dan Bracuk
 
Posts: n/a
Diggs:
Default Re: cfloop over a file - set start point?

I didn't read your link, but my method would be to treat the file as a list separated by chr(10) & chr(13).
Reply With Quote


  #4 (permalink)  
Old 08-29-2008, 01:33 AM
-==cfSearching==-
 
Posts: n/a
Diggs:
Default Re: cfloop over a file - set start point?

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>


Reply With Quote
  #5 (permalink)  
Old 08-29-2008, 01:58 PM
phamm
 
Posts: n/a
Diggs:
Default Re: cfloop over a file - set start point?

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?

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 10:29 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk