IonicWind Software

IWBasic => Console Corner => Topic started by: plurald on September 28, 2009, 03:59:11 PM

Title: Strange READ results from TXT file
Post by: plurald on September 28, 2009, 03:59:11 PM
There must be something obvious I am missing regarding trying to read numbers from a text file into an INT variable named myVar.  Here is an example of the data in the file:
2,2,1,1,3,3,0,0,0

There are nine numbers in this first data line separated by comma's.
Here is the code to read this data:
while EOF(myFile) = 0
   IF(READ(myFile,myVar) = 0)
      PRINT STR$(myVar)
   ENDIF
endwhile

What gets displayed in the console screen from the PRINT statement are not the above single-digit numbers.  Instead, for each number read it shows  9 digits followed by .00     For example, the first number in my file display's as  7414856818.00   

Any ideas what I'm doing wrong?

Thanks.
Title: Re: Strange READ results from TXT file
Post by: LarryMc on September 28, 2009, 04:10:38 PM
how did you declare myFile and myVar ?

Larry
Title: Re: Strange READ results from TXT file
Post by: plurald on September 28, 2009, 05:35:05 PM
Thanks for the hint.  I had copied the file definition from another program that used a file as a BFILE.   I changed it to FILE and now all is well.   Thanks.