With CFFILE you're only able to read the entire file into a variable.  Treat
the file contents as a list, using carriage returns and/or line feeds as
delimiters.  Because of the way CF handles lists and delimiters, the
following code works regardless of whether carriage returns, line feeds or
any comibination of the two were used between lines.

<cffile action="read" file="c:\myfile.txt" variable="x">
<cfloop index="line" list="#x#" delimiters="#Chr(13)##Chr(10)#">
  <!--- do whatever you need with 'line' --->
  ...
</cfloop>

Jim


----- Original Message -----
From: "Terry - it-werks.com" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, September 30, 2000 3:33 PM
Subject: Reading a file one line at a time with CFfile?


> I have a text file that is 1315 characters wide, which is an exported
Cobol
> database that I reed to go through one record/line at a time and do some
> mid() calls to retreive certain fields and insert them into an Access
table.
> I am unsure how to walk thru the file line by line. I do know how to use
> mid() though. I could sure use some help here.
>
> Terry Troxel

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to