🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #185

Re: MP3 tag code ?

#185
From: Mark Jacobs
Date: Sat, 22 Sep 2007 11:11
30 lines
2119 bytes
"Jim Davis" <jim46dd@hotmail.com> wrote in message 
news:Xns99A1DC0C76EA7jim46ddhotmailcom@207.105.83.66...
> Seeking C or C++ source
> to read *.MP3 ID3v2 tags

OK. This is C-style code. It gets the info at the end of the mp3 file marked 
with the letters 'TAG'. Some of this may be truncated. I assume mfnm is an 
AnsiString holding the name of the MP3 file.

    FILE *fpj=fopen(mfnm.c_str(),"rb"); int nbry=0;
    char btgf[130],sngnm[35],artst[35],albm[35],yur[5],cmmnt[35];
    if (fpj)
    {
      if (fseek(fpj,-128,SEEK_END)==0) 
nbry=fread(btgf,sizeof(char),128,fpj);
      fclose(fpj);
    }
    if (nbry>0 && btgf[0]=='T' && btgf[1]=='A' && btgf[2]=='G')
    {
      strncpy(sngnm,&btgf[3],30*sizeof(char)); sngnm[30]='\0';
      strncpy(artst,&btgf[33],30*sizeof(char)); artst[30]='\0';
      strncpy(albm,&btgf[63],30*sizeof(char)); albm[30]='\0';
      strncpy(yur,&btgf[93],4*sizeof(char)); yur[4]='\0';
      strncpy(cmmnt,&btgf[97],30*sizeof(char)); cmmnt[30]='\0';
    }

HTH
-- 
Mark Jacobs
http://jacobsm.com
Technical Details
Message-ID: <46f4f84f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <Xns99A1DC0C76EA7jim46ddhotmailcom@207.105.83.66>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10d0fc,ae53320f888388d4
X-Google-Attributes: gid10d0fc,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Mark Jacobs" <www.jacobsm.com/mjmsg.htm?Borland Newsgroup>
From: "Mark Jacobs" <www.jacobsm.com/mjmsg.htm?Borland Newsgroup>
Newsgroups: borland.public.cppbuilder.multimedia
References: <Xns99A1DC0C76EA7jim46ddhotmailcom@207.105.83.66>
Subject: Re: MP3 tag code ?
Date: Sat, 22 Sep 2007 12:11:23 +0100
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 195.137.123.182
Message-ID: <46f4f84f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1190459471 195.137.123.182 (22 Sep 2007 04:11:11 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail