[Gambas-user] File access "System error, Illegal seek"

Rob sourceforge-raindog2 at ...94...
Sun Aug 17 20:23:40 CEST 2003


On Sunday 17 August 2003 09:48, DHoll28158 at ...87... wrote:
> I have this file access program that gives me a "System error, Illegal
> seek" when I do a write after I have done a read.

I didn't know you could INPUT# directly from a device (which is what you're 
accessing, not a file.)  I thought you had to open it as READ WRITE WATCH or 
something like that.

Here's some sample code from Benoit's announcement of 0.60, when this ability 
was first added, maybe it will help:  (I haven't tested it as I can't find my 
old modem.)

'-------------------------
' Gambas module

PRIVATE hPort AS File

PUBLIC SUB Main()

  OPEN "/dev/ttyS0" FOR READ WRITE WATCH AS #hPort

END

PUBLIC SUB File_Read()

  DIM iByte AS Byte

  PRINT "I can read at least one byte on the port"
  READ #hPort, iByte
  PRINT iByte

END

PUBLIC SUB File_Write()

  PRINT "I can write on the port"
  WRITE #hPort, 42

END

'-------------------------





More information about the User mailing list