[Gambas-user] Stream IO
Benoît Minisini
gambas at ...1...
Sun Aug 25 19:32:16 CEST 2002
Le Mercredi 21 Août 2002 15:55, Laszlo Parkanyi a écrit :
> Hi,
>
> When trying a simple stream IO with the following code:
>
> DIM sFilnam AS String
> DIM sLine AS String
> DIM iUnit AS Integer
>
> iUnit = 1
>
> sFilnam = "CONFIG.lingx"
> OPEN sFilnam FOR READ AS #iUnit
>
> WHILE NOT Eof(iUnit)
> LINE INPUT #iUnit sLine
> PRINT sLine
> WEND
>
> I get an error message pointing to line "OPEN..." saying "Type mismatch:
> wanted Integer got File instead". What is wrong here?
>
> Cheers,
> Laszlo
>
>
Gambas is not Visual Basic, and its file handles are not integers. They are
File objects ! So you must write :
DIM sFilnam AS String
DIM sLine AS String
DIM hUnit AS File
sFilnam = "CONFIG.lingx"
OPEN sFilnam FOR READ AS #hUnit
WHILE NOT Eof(hUnit)
LINE INPUT #hUnit, sLine
PRINT sLine
WEND
--
Benoît Minisini
mailto:gambas at ...1...
More information about the User
mailing list