File of *Type*

Thread Solved

Join Date: Sep 2008
Posts: 10
Reputation: espSquall is an unknown quantity at this point 
Solved Threads: 1
espSquall espSquall is offline Offline
Newbie Poster

File of *Type*

 
0
  #1
Sep 25th, 2008
The declaration of the type is:
Pascal and Delphi Syntax (Toggle Plain Text)
  1. type
  2. TMediaLibrary = record
  3. Title:string[30];
  4. TrackNo:integer;
  5. Artist:string[30];
  6. Album:string[30];
  7. Year:string[4];
  8. Genre:string[30];
  9. Comment:String[30];
  10. Directory:string;
  11. end;
  12.  
  13. var SongInfo: TMediaLibrary;

and the file implementation of it is here:

Pascal and Delphi Syntax (Toggle Plain Text)
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3. SongFile:string;
  4. MediaLibrary: file of TMediaLibrary; <<<Error is here
  5. begin
  6. .
  7. .
  8. .
  9. .
  10. AssignFile(MediaLibrary, 'C:\Program Files\toMedia Player\data\libr.db');
  11. rewrite(MediaLibrary);
  12. Write(MediaLibrary, SongInfo);
  13. CloseFile(MediaLibrary);
  14. end;

My problem is that when i try to compile the code it gives the error "Type TMediaLibrary needs finalization - not allowed in file type". This is my first post on any coding community site as most problems have already been solved already, but this has stumped me and google.

Thanks alot for any help.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 811
Reputation: pritaeas is on a distinguished road 
Solved Threads: 133
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark

Re: File of *Type*

 
0
  #2
Sep 26th, 2008
The string (Directory) in the record is causing your problem. You'll need to change it to e.g. string[30]. string may not appear in a typed file, since it's length is undetermined.
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 10
Reputation: espSquall is an unknown quantity at this point 
Solved Threads: 1
espSquall espSquall is offline Offline
Newbie Poster

Re: File of *Type*

 
0
  #3
Sep 26th, 2008
Thanks a lot that sorted it.

Tom
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC