Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Aug : Reading File Structure
| Subject: | Reading File Structure |
| Posted by: | "Benedictum" (benedict..@dominusvobis.com) |
| Date: | Fri, 24 Aug 2007 09:54:05 |
Whenever I attempt to read a tag from an mp3 file on CD I get an "file
access denied". I know that files on CD are readonly. I need only to read
the ID3 tag of the mp3 file. Any other ways to accomplish this?
Here is the code that I use:
function GetID3Tag(aSong: TFileName): Boolean;
var
f: file;
error: integer;
begin
AssignFile(f, aSong);
{$I-} reset(f, 1); {$I+} // produces "file access denied" on CD files but
ok with fixed drives.
error := IOResult;
if error = 0 then begin
Seek(f, FileSize(f) - 128);
BlockRead(f, ID3Tag, SizeOf(ID3Tag));
CloseFile(f);
Result := ID3Tag.Header = 'TAG';
end else Result := false;
end;