I can do something like this: 
    
    
    type
      MyType* = object
        somefield*: array[10, int16]
    var t: MyType
    var f = newFileStream("/tmp/tmp.mytype", fmWrite)
    if not fff.isNil:
      f.write t
    

but result file contains garbage, size of file is 20 bytes.

So question is how to read/write object from/to file?

Reply via email to