[Gambas-user] File_Read() doesn't work
g4mba5 at gmail.com
Tue Aug 10 18:49:35 CEST 2021
Le 03/08/2021 à 23:28, Jussi Lahtinen a écrit :
> The bug should have been fixed by commit
> Still a problem or does my code have yet something odd..?
> See the attachment.
> And probably related issue; I don't understand how this has worked for
> so many years:
> tmp = ""
> Seek #hWatchFile, 9 <-- Seek to the last byte.
> Read #hWatchFile, tmp <--- tmp is string.
> And magically the tmp variable contained "test". How!???
> Now it is:
> tmp = ""
> Seek #hWatchFile, 5 <-- Seek to the string.
> Read #hWatchFile, tmp <--- tmp now contains "test" as it should.
> Any idea why this worked? My brain is a bit rusty. I haven't touched
> computers for a while.
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
I have fixed the interpreter so that read watch are automatically
disabled on end of file only for pipes, process and standard input streams.
You must run your weird code step by step to understand what happens.
Moreover, 'Read #hWatchFile, tmp' is a Gambas 2 syntax. You must not use
it in your test project. Beware that it does not read the contents of a
string, but a Gambas string binary format, and it fails. See the
More information about the User