Quantcast

Open File for Watch Read Past EOF

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Open File for Watch Read Past EOF

Jeff Zacher
I am using Gambas 3.9.1

If I open a file for watch:

hFile = Open "test" For Read Write Watch

The _Read() event gets the first byte written to the file just fine. But
after, no changes to the file fire the read event. So as a workaround,
just close the file and reopen? On second read the _Read() event in
fired immediately and continues to fire past the eof until the file is
again closed.

Code to reproduce. Form with two buttons:


 Gambas class file

Private hFile As File

Public Sub File_Read()

  Dim iByte As Byte
  If Not Eof(hfile) Then
        Read #hFile, iByte
  Print "Got one byte: "; iByte
  Else
  Print Time()
  End If
End

Public Sub Button1_Click()

   Close hFile

End

Public Sub Button2_Click()

  hFile = Open "test" For Read Watch

End

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Open File for Watch Read Past EOF

Gianluigi
Hello Jeff,
Your mail is seen as spam, raise it with this answer.
"Test" what kind of file it is?

Regards
Gianluigi

2017-01-09 14:35 GMT+01:00 Jeff Zacher <[hidden email]>:

> I am using Gambas 3.9.1
>
> If I open a file for watch:
>
> hFile = Open "test" For Read Write Watch
>
> The _Read() event gets the first byte written to the file just fine. But
> after, no changes to the file fire the read event. So as a workaround,
> just close the file and reopen? On second read the _Read() event in
> fired immediately and continues to fire past the eof until the file is
> again closed.
>
> Code to reproduce. Form with two buttons:
>
>
>  Gambas class file
>
> Private hFile As File
>
> Public Sub File_Read()
>
>   Dim iByte As Byte
>   If Not Eof(hfile) Then
>         Read #hFile, iByte
>         Print "Got one byte: "; iByte
>   Else
>         Print Time()
>   End If
> End
>
> Public Sub Button1_Click()
>
>    Close hFile
>
> End
>
> Public Sub Button2_Click()
>
>   hFile = Open "test" For Read Watch
>
> End
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...