New topic: File I/O and Classes
<http://forums.realsoftware.com/viewtopic.php?t=46063> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message RBnoob2012 Post subject: File I/O and ClassesPosted: Wed Nov 28, 2012 8:50 am Joined: Sat Aug 18, 2012 11:23 am Posts: 17 Hello all, In VB6 I would have a User-Defined Type (UDT) that created a single record of a determinable length. 'In RB I've created a Class: Class TheClass Text() as String SomeData() as Integer MoreData() As Integer End Class ' I create an array of TheClass tc() as TheClass 'Later I dim it to 11 records ReDim tc(10) For i = 0 to 10 tc(i) = new NewClass redim tc(i).Text(4) redim tc(i).SomeData(4) redim tc(i).MoreData(4) Next i All of this works beautifully. The problem is ... I know that there's 11 records. But the user will be able to add records. In VB6 I used to get the length of the file, determine the length of each record, and divide them to get the number of records. Writing to disk seems simple enough. But how do I determine the number of records in a serialized file when I want to read the data? I've wondered if .Append is the way to go by deserializing the file in a loop, but how do I know when to start and stop each "record" since the Text string length can vary? Can anyone point me in the right direction? Thanks, RBnoob Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
