<cffile action="read" file="c:\inetpub\wwwroot\mytext.txt" variable="myText">
<!--- insert the proper path above :)  --->

<cfscript>
        myArray = arrayNew(1);
        
        for (i=1; i LTE listLen(myText, chr(13)&chr(10)); i=i+1) {
                myArray[i] = structNew();
                myArray[i].position = i;
                myArray[i].value = listGetAt(myText, i, chr(13)&chr(10));
        }
</cfscript>
<cfdump var="#myArray#">

you don't necessarily need to store the "position" variable, since the
iteration of the loop (and resultant position in the array) will
indicate that.  if there's no other factors that I'm overlooking, you
should be able to just store each element in an array (without the
nested structs).

On 10/25/05, Richard Colman <[EMAIL PROTECTED]> wrote:
> I need to read a file like:
>
>
>
> -1.2
>
> -0.0
>
> -189.7
>
> 0.6
>
> 44.6
>
> -12.3
>
> -1.9
>
> -85.9
>
> 16.3
>
> -197.3
>
> 20.6
>
> -1.6
>
> 0.0
>
> -25.1
>
> -53.7
>
> 17.4
>
>
>
> And insert each value into a data table, like:
>
>
>
> First Record: 1, -1.2
>
> Second Record: 2, -0.0
>
> Third Record: 3, -189.7
>
>
>
> Etc.
>
>
>
> I am not sure how to parse the text file and do the insert. Can anyone offer
> a suggestion?
>
>
>
> Thank you.
>
>
>
> Rick Colman
>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222246
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to