[Gambas-user] Error in file read when length is a negative value ?

Gianluigi bagonergi at gmail.com
Sun Jan 17 14:53:00 CET 2021


Il giorno dom 17 gen 2021 alle ore 10:03 Vinode Singh Ujlain <
ujlain at gmail.com> ha scritto:

> EOF .. I was looking at http://gambaswiki.org/wiki/lang/read?nh
>
> *Variable* *= READ* [ *#* *Stream* *,* ] *Length* ...
>

Hi Vinode,
I believe you have misunderstood the use of Variable = READ [# Stream,]
Length

If you want to get the last stream you have to write the code like this:

Public Sub Main()

  Dim hFile As File
  Dim sFile As String

  hFile = Open "./my-demo.txt" For Read
  Seek #hFile, -4
  Read #hFile, sFile, 4
  Print sFile
  hFile.Close

End

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210117/7e2b23e3/attachment.htm>


More information about the User mailing list