[Gambas-user] saving files

Jochen Georges jochengeorges at ...467...
Wed Dec 29 08:20:15 CET 2004


Hello gambanauts,

i would like to save an object of a selfdefined class into a file, just like
http://www.binara.com/gambas-wiki/bin/view/Gambas/MiscFilesMydatatype

But this does not work ??
------------------------------------------------------------------------
PUBLIC mc AS MyClass

PUBLIC SUB _new()
  mc = NEW MyClass
END

PUBLIC SUB Button1_Click()
  myFile AS File
  OPEN "/home/jochen/test.mcf" FOR CREATE AS myFile
    'mc.WriteTo(myFile) 'unknown symbol 'WriteTo' in class 'MyClass'
      'but it works in the wiki-example !?
      'can't find information about WriteTo
    'WRITE myFile,mc 'Type mismatch: wanted Integer Type, got MyClass instead
    WRITE #myFile,mc 'Type mismatch: wanted Standard Type, got MyClass instead
  CLOSE myFile
END
------------------------------------------------------------------------
'MyClass.class:
wort AS String
zahl AS Integer

PUBLIC SUB _new()
 wort = "Hallo"
 zahl = 3
END
------------------------------------------------------------------------

Thanks for any hint.

Beste Gruesse
Jochen




More information about the User mailing list