Computer Science Canada

how do I save records to disk??

Author:  DanShadow [ Sat Jan 24, 2004 8:58 pm ]
Post subject:  how do I save records to disk??

Im making an application which is essentially a Forum...for users on one login account. Now my problem is, ive created a record called "Forum"...then an array "inputForum: array 1..100 of forum"...and cannot save the record.. can you please help>???
code:

type Forum :
    record
        sender : string
        subject : string
        text : string
        datewritten : string
    end record
var inputForum : array 1 .. 100 of Forum
var datafile : int
for i : 1 .. 100
    inputForum (1).sender := "Dan"
    inputForum (1).subject := "My New Computer Forum!"
    inputForum (1).text := "Well, as you can see, I now have coded my own forum, which supports multiple users over 1 computer to send messages to eachother! Enjoy!"
    inputForum (1).datewritten := Time.Date
    inputForum (1).sender := ""
    inputForum (1).subject := ""
    inputForum (1).text := ""
    inputForum (1).datewritten := ""
end for
open : datafile, "Forum", put
for i : 1 .. 100
    put : datafile, inputForum (i)
end for
close : datafile

Author:  Delos [ Sat Jan 24, 2004 9:37 pm ]
Post subject: 

You need to specify the exact element of "forum" to be written.

I.e.

put : file, forum(i).sender

etc etc.

Author:  DanShadow [ Sat Jan 24, 2004 9:50 pm ]
Post subject: 

yay! thanks a lot man! Here, have a a little bi ts
[+5 bits]


: