[Gambas-user] Error writing Binary data - Gambas 2.99.0

Ian Roper ian.roper at ...1974...
Sat Feb 12 08:29:40 CET 2011


Greetings all,

I am trying to write some simple binary data to a file being  ~ Integers
1 - 5000

I keep getting this error     [Error: Type missmatch : wanted string ,
got integer instead.]

So I copied the example from <http://gambasdoc.org/help/lang/write> as
below.

This code comes up with the same error ?


  DIM binaryFile AS File
  DIM i AS Integer = 10
  DIM b AS Byte = 4
  DIM s AS Short = 23
  DIM s1 AS String = "This is string 1"
  DIM s2 AS String = "Another string"
  ' Open as create so we get a new file
  binaryFile = OPEN FilePath FOR CREATE
  WRITE #binaryFile, i    '<<----------<<<<<< Error occurs here.
  WRITE #binaryFile, b
  WRITE #binaryFile, s
  WRITE #binaryFile, s1
  WRITE #binaryFile, s2
  CLOSE #binaryFile

Confirmed I have write access : changed WRITE to use a string variable
and it works fine.

Changed to Gambas 2.22 and same code worked as it should, - able to
write & read.

Can someone else please test.

Thanks in advance.

Regards,
Ian Roper
Perth Western Australia.




More information about the User mailing list