[Gambas-user] Filehandle and #

Fabien Bodard gambas.fr at ...626...
Wed Nov 21 16:55:56 CET 2007


Le Wednesday 21 November 2007 16:38:11 smiefert at ...784..., vous avez écrit :
> hello,
>
> i dontunderstand the code below. Why i sometimes  use hFile and sometimes
> #hFile
>
> and what d the line
>
> LINE INPUT #hFile,sLig?!?
>
> SUB PrintFile(filename AS STRING)
>   DIM hfile AS File
>   DIM sLig AS String
>
>   OPEN Filename FOR READ AS #hFile
>
> WHILE NOT EOF(hFile)
>   LINE INPUT #hFile,sLig
>  Print sLig
>
> CLOSE #hFile
>
> END
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user


hFile is a variable that represent a file

#hFile is a stream access to this var

LINE INPUT #hFile, slig : Read a line in the file hFile as assign it to the 
sLig Variable that is a string var

OPEN Filename FOR READ AS #hFile : is the old opening synthax

now we use:

hFile = OPEN Filename FOR READ

Fabien




More information about the User mailing list