[Gambas-user] integer / string file IO issue
Benoît Minisini
gambas at ...1...
Fri Jun 5 09:40:12 CEST 2009
> Dear users,
>
> I am having a strange issue in relation to gambas.
>
> First I have:
>
> DIM farmid AS NEW Integer[100000]
> DIM farmx AS NEW Integer[100000]
> DIM farmy AS NEW Integer[100000]
> DIM farmwo AS NEW Integer[100000]
> DIM farmcl AS NEW Integer[100000]
> DIM farmir AS NEW Integer[100000]
> DIM farmwh AS NEW Integer[100000]
> DIM farmmx AS NEW Integer[100000]
> DIM farmdd AS NEW Integer[100000]
> DIM farmmm AS NEW Integer[100000]
> DIM farmyyyy AS NEW Integer[100000]
> DIM farmhh AS NEW Integer[100000]
> DIM farmlcav AS NEW Integer[100000]
>
A few megabytes used there. It reminds me my Amstrad CPC464 when I had 48K
memory free... :-)
> That's fine, then in a file called ff.dat I have the following:
>
> 1
> 142820 149 661 16 14 14 12 0 6 2009 0
>
> My problem is, this code is causing a break:
>
> ff = OPEN "~/ff.dat" FOR READ
> INPUT #ff, farmers
> PRINT farmers
> FOR a = 1 TO farmers
> INPUT #ff, farmid[a - 1], farmx[a - 1], farmy[a - 1], farmwo[a - 1],
> farmcl[a - 1], farmir[a - 1], farmwh[a - 1], farmdd[a - 1], farmmm[a -
> 1], farmyyyy[a - 1], farmhh[a - 1]
> PRINT farmid[a - 1], farmx[a - 1], farmy[a - 1], farmwo[a - 1],
> farmcl[a - 1], farmir[a - 1], farmwh[a - 1], farmdd[a - 1], farmmm[a -
> 1], farmyyyy[a - 1], farmhh[a - 1]
> farmmx[a - 1] = Max(Max(farmwo[a - 1], farmcl[a - 1]), Max(farmcl[a
> - 1], farmir[a - 1]))
> PRINT farmmx[a - 1]
> NEXT
> CLOSE #ff
>
> It's telling me that I am trying to put a string into an integer on the
> 5th line. Which makes no sence because the file contains no strings,
> just integers. I am at a loss to work this out.
>
> Beren
>
Please provide your project source, so that I can see what is wrong exactly.
Regards,
--
Benoît
More information about the User
mailing list