[futurebasic] Loading a TabDelimited file to Array

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2010 : Group Archive : Group : All Groups

From: Tom Russell <tom@...>
Date: Thu, 15 Apr 2010 20:06:23 -0400
I am trying to load a tab delimited file to an array.

My code to do this looks like this:

Dim as int i,j
Dim as OSErr Err,ignore
Dim as FSSpec inSpec
Dim fName$

Appearance WINDOW 2,"Comment",(0,0)-(500,200),  _kDocumentWindowClass
TEXT _times,12, _plainText
PRINT   "Now Loading HistoricDataTabDelimited Array from Hard Disk"

err = fn FSMakeFSSpec( system( _aplVRefNum ), system( _aplParID ), "HistoricDataTabDelimited.txt", @inSpec )

OPEN "I",1, @inSpec// "HistoricData"//"Macintosh HD:A99Daily:NarrowDatato98"   "StoreBasicdata"

FOR i= 0 TO 12000

  INPUT #1, M(0,i) 'M(1,i) M(2,i) M(3,i) M(4,i) M(5,i) M(6,i) M(7,i) M(8,i) M(9,i)
Next i

PRINT   "Completed Loading HistoricData Array from Hard Disk"

M is my array, but the file is a 10 col by 12000 data points.

How do I load the array so that it is 10,12000?

Also I noticed that this same program I export my array to a tab delimited file but I noticed that it saves it as a simple text file rather than a plain text file. This causes a problem when I try to load the data back, is there a way to set the format type to the file when I save it?