I have the following classes:
type TSong = class(TObject) private FArtist: String; FTitle: String; procedure SetArtist(Artist: String); procedure SetTitle(Title: String); public property Artist: String read FArtist Write SetArtist; property Title: String read FTitle Write SetTitle; constructor Create(Artist, Title: String); end; type TPlaylist = class(TList) private procedure ShowInListBox(Box: Pointer); public { Public-Deklarationen } end;
At runtime, I instantiate these classes:
Playlist := TPlaylist.Create; Playlist.Add(TSong.Create('Artist 1', 'Title 1')); Playlist.Add(TSong.Create('Artist 2', 'Title 2')); Playlist.Add(TSong.Create('Artist 3', 'Title 3')); Playlist.Add(TSong.Create('Artist 4', 'Title 4'));
When the program is closed, I would like to save this data to a text file. How can i do this?
The best way would probably be to create a procedure related to the TPlaylist class, right?
procedure SaveToTxtFile(fName: String);
What should such a function do? When the program starts again, I would like to create a playlist again.
It would be nice if the data were saved in a text file as follows:
Artist 1///Title 1 Artist 2///Title 2
source share