Can structures (user defined type) be saved & loaded with Files (core library)?
For example, I wrote below.
Sub Globals
Type TPtData(Name as String, Age as Int)
Dim PData as TPtData
Dim PList as List
Dim FDlg As FileDialog
End Sub
Sub DataInput
PData.Initialize
PList.Initialize
PData.Name ="Mr A"
PData.Age =45
PList.Add(PData)
PData.Name ="Mrs B"
PData.ID =38
PList.Add(PData)
End Sub
Sub DataSave
FDlg.FilePath = File.DirDefaultExternal
File.WriteList(FDlg.FilePath, FDlg.ChosenName, PList)
End Sub
Sub DataLoad
Dim i as Int
PList.Initialize
FDlg.FilePath = File.DirDefaultExternal
PList =File.ReadList(FDlg.FilePath, FDlg.ChosenName)
For i=0 To PList.Size-1
PData =PList.Get(i) '*
Next
End Sub
An error has occurred in '* line.
java.lang.ClassCastException:java.lang.String
Please Help me!:sign0085:
For example, I wrote below.
Sub Globals
Type TPtData(Name as String, Age as Int)
Dim PData as TPtData
Dim PList as List
Dim FDlg As FileDialog
End Sub
Sub DataInput
PData.Initialize
PList.Initialize
PData.Name ="Mr A"
PData.Age =45
PList.Add(PData)
PData.Name ="Mrs B"
PData.ID =38
PList.Add(PData)
End Sub
Sub DataSave
FDlg.FilePath = File.DirDefaultExternal
File.WriteList(FDlg.FilePath, FDlg.ChosenName, PList)
End Sub
Sub DataLoad
Dim i as Int
PList.Initialize
FDlg.FilePath = File.DirDefaultExternal
PList =File.ReadList(FDlg.FilePath, FDlg.ChosenName)
For i=0 To PList.Size-1
PData =PList.Get(i) '*
Next
End Sub
An error has occurred in '* line.
java.lang.ClassCastException:java.lang.String
Please Help me!:sign0085: