On Fri, 3 Dec 2004 10:37:54 -0500, Joe Rinehart <[EMAIL PROTECTED]> wrote:
> Yep - this should get you started:
>
> <cfscript>
> filename = "/path/to/file.csv";
> fileReader = createObject("java", "java.io.FileReader");
> fileReader = fileReader.init(filename);
> lineReader = createObject("java","java.io.LineNumberReader");
> lineReader = lineReader.init(fileReader);
>
> line = lineReader.readLine();
>
> /* this'd keep reading in lines
> while (isDefined("line")) {
> lineCount = lineCount + 1;
>
> // do something here with the data in variable line
>
> line = lineReader.readLine();
> }
> */
> </cfscript>
>
> <cfoutput>#line#</cfoutput>
>
Shouldn't there be a .close() statement in there somewhere at the
bottom? Otherwise you're going to have tons of open files on your
system (I learned this one the hard way!!).
Regards,
Dave.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186089
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54