Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: C  |  size: 14.55 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /*
  5. Orden de los campos en ID3v1:
  6. Titulo (30)
  7. Artista (30)
  8. Album (30)
  9. Año (4)
  10. Compositor/Comentario (28)
  11. Byte en cero (1)
  12. Numero de pista (1)
  13. Byte con genero (1)
  14.  
  15. Total: 125.
  16. + bytes 'T','A','G'
  17. -------
  18. 128
  19.  
  20. */
  21.  
  22. /*
  23.  
  24. Codigo de genero:
  25.                         0    => 'Blues',
  26.                         1    => 'Classic Rock',
  27.                         2    => 'Country',
  28.                         3    => 'Dance',
  29.                         4    => 'Disco',
  30.                         5    => 'Funk',
  31.                         6    => 'Grunge',
  32.                         7    => 'Hip-Hop',
  33.                         8    => 'Jazz',
  34.                         9    => 'Metal',
  35.                         10   => 'New Age',
  36.                         11   => 'Oldies',
  37.                         12   => 'Other',
  38.                         13   => 'Pop',
  39.                         14   => 'R&B',
  40.                         15   => 'Rap',
  41.                         16   => 'Reggae',
  42.                         17   => 'Rock',
  43.                         18   => 'Techno',
  44.                         19   => 'Industrial',
  45.                         20   => 'Alternative',
  46.                         21   => 'Ska',
  47.                         22   => 'Death Metal',
  48.                         23   => 'Pranks',
  49.                         24   => 'Soundtrack',
  50.                         25   => 'Euro-Techno',
  51.                         26   => 'Ambient',
  52.                         27   => 'Trip-Hop',
  53.                         28   => 'Vocal',
  54.                         29   => 'Jazz+Funk',
  55.                         30   => 'Fusion',
  56.                         31   => 'Trance',
  57.                         32   => 'Classical',
  58.                         33   => 'Instrumental',
  59.                         34   => 'Acid',
  60.                         35   => 'House',
  61.                         36   => 'Game',
  62.                         37   => 'Sound Clip',
  63.                         38   => 'Gospel',
  64.                         39   => 'Noise',
  65.                         40   => 'Alt. Rock',
  66.                         41   => 'Bass',
  67.                         42   => 'Soul',
  68.                         43   => 'Punk',
  69.                         44   => 'Space',
  70.                         45   => 'Meditative',
  71.                         46   => 'Instrumental Pop',
  72.                         47   => 'Instrumental Rock',
  73.                         48   => 'Ethnic',
  74.                         49   => 'Gothic',
  75.                         50   => 'Darkwave',
  76.                         51   => 'Techno-Industrial',
  77.                         52   => 'Electronic',
  78.                         53   => 'Pop-Folk',
  79.                         54   => 'Eurodance',
  80.                         55   => 'Dream',
  81.                         56   => 'Southern Rock',
  82.                         57   => 'Comedy',
  83.                         58   => 'Cult',
  84.                         59   => 'Gangsta Rap',
  85.                         60   => 'Top 40',
  86.                         61   => 'Christian Rap',
  87.                         62   => 'Pop/Funk',
  88.                         63   => 'Jungle',
  89.                         64   => 'Native American',
  90.                         65   => 'Cabaret',
  91.                         66   => 'New Wave',
  92.                         67   => 'Psychedelic',
  93.                         68   => 'Rave',
  94.                         69   => 'Showtunes',
  95.                         70   => 'Trailer',
  96.                         71   => 'Lo-Fi',
  97.                         72   => 'Tribal',
  98.                         73   => 'Acid Punk',
  99.                         74   => 'Acid Jazz',
  100.                         75   => 'Polka',
  101.                         76   => 'Retro',
  102.                         77   => 'Musical',
  103.                         78   => 'Rock & Roll',
  104.                         79   => 'Hard Rock',
  105.                         80   => 'Folk',
  106.                         81   => 'Folk/Rock',
  107.                         82   => 'National Folk',
  108.                         83   => 'Swing',
  109.                         84   => 'Fast-Fusion',
  110.                         85   => 'Bebob',
  111.                         86   => 'Latin',
  112.                         87   => 'Revival',
  113.                         88   => 'Celtic',
  114.                         89   => 'Bluegrass',
  115.                         90   => 'Avantgarde',
  116.                         91   => 'Gothic Rock',
  117.                         92   => 'Progressive Rock',
  118.                         93   => 'Psychedelic Rock',
  119.                         94   => 'Symphonic Rock',
  120.                         95   => 'Slow Rock',
  121.                         96   => 'Big Band',
  122.                         97   => 'Chorus',
  123.                         98   => 'Easy Listening',
  124.                         99   => 'Acoustic',
  125.                         100  => 'Humour',
  126.                         101  => 'Speech',
  127.                         102  => 'Chanson',
  128.                         103  => 'Opera',
  129.                         104  => 'Chamber Music',
  130.                         105  => 'Sonata',
  131.                         106  => 'Symphony',
  132.                         107  => 'Booty Bass',
  133.                         108  => 'Primus',
  134.                         109  => 'Porn Groove',
  135.                         110  => 'Satire',
  136.                         111  => 'Slow Jam',
  137.                         112  => 'Club',
  138.                         113  => 'Tango',
  139.                         114  => 'Samba',
  140.                         115  => 'Folklore',
  141.                         116  => 'Ballad',
  142.                         117  => 'Power Ballad',
  143.                         118  => 'Rhythmic Soul',
  144.                         119  => 'Freestyle',
  145.                         120  => 'Duet',
  146.                         121  => 'Punk Rock',
  147.                         122  => 'Drum Solo',
  148.                         123  => 'A Cappella',
  149.                         124  => 'Euro-House',
  150.                         125  => 'Dance Hall',
  151.                         126  => 'Goa',
  152.                         127  => 'Drum & Bass',
  153.                         128  => 'Club-House',
  154.                         129  => 'Hardcore',
  155.                         130  => 'Terror',
  156.                         131  => 'Indie',
  157.                         132  => 'BritPop',
  158.                         133  => 'Negerpunk',
  159.                         134  => 'Polsk Punk',
  160.                         135  => 'Beat',
  161.                         136  => 'Christian Gangsta Rap',
  162.                         137  => 'Heavy Metal',
  163.                         138  => 'Black Metal',
  164.                         139  => 'Crossover',
  165.                         140  => 'Contemporary Christian',
  166.                         141  => 'Christian Rock',
  167.                         142  => 'Merengue',
  168.                         143  => 'Salsa',
  169.                         144  => 'Trash Metal',
  170.                         145  => 'Anime',
  171.                         146  => 'JPop',
  172.                         147  => 'Synthpop',
  173.  
  174.                         255  => 'Unknown',
  175.  
  176.  
  177. */
  178.  
  179.  
  180. /*publicar:*/
  181. typedef struct tags_t{
  182.         char Titulo[30];
  183.         char Artista[30];
  184.         char Album[30];
  185.         char Year[4];
  186.         char compositor[28];
  187.         char Ubyte;
  188.         char NPista;
  189.         unsigned char genero;
  190.  
  191. } tags_t;
  192.  
  193. char* genres[149] = {"Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge","Hip-Hop","Jazz","Metal","New Age","Oldies","Other","Pop","R&B","Rap","Reggae","Rock","Techno","Industrial","Alternative","Ska","Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient","Trip-Hop","Vocal","Jazz+Funk","Fusion","Trance","Classical","Instrumental","Acid","House","Game","Sound Clip","Gospel","Noise","Alt. Rock","Bass","Soul","Punk","Space","Meditative","Instrumental Pop","Instrumental Rock","Ethnic","Gothic","Darkwave","Techno-Industrial","Electronic","Pop-Folk","Eurodance","Dream","Southern Rock","Comedy","Cult","Gangsta Rap","Top 40","Christian Rap","Pop/Funk","Jungle","Native American","Cabaret","New Wave","Psychedelic","Rave","Showtunes","Trailer","Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro","Musical","Rock & Roll","Hard Rock","Folk","Folk/Rock","National Folk","Swing","Fast-Fusion","Bebob","Latin","Revival","Celtic","Bluegrass","Avantgarde","Gothic Rock","Progressive Rock","Psychedelic Rock","Symphonic Rock","Slow Rock","Big Band","Chorus","Easy Listening","Acoustic","Humour","Speech","Chanson","Opera","Chamber Music","Sonata","Symphony","Booty Bass","Primus","Porn Groove","Satire","Slow Jam","Club","Tango","Samba","Folklore","Ballad","Power Ballad","Rhythmic Soul","Freestyle","Duet","Punk Rock","Drum Solo","A Cappella","Euro-House","Dance Hall","Goa","Drum & Bass","Club-House","Hardcore","Terror","Indie","BritPop","Negerpunk","Polsk Punk","Beat","Christian Gangsta Rap","Heavy Metal","Black Metal","Crossover","Contemporary Christian","Christian Rock","Merengue","Salsa","Trash Metal","Anime","JPop","Synthpop","Unknown"};
  194.  
  195. /*funciones privadas:*/
  196. void todobien()
  197. {
  198.         printf("**todo bien**\n");
  199. }
  200.  
  201. int caracterimprimible(char c)
  202. {
  203.         return (c<32 || c>126)?0:1;
  204. }
  205.  
  206. int length(char* a, int max)
  207. {
  208.         int n=0;
  209.         while (caracterimprimible(a[n]) && n<max)
  210.                 n++;
  211.         return n;
  212. }
  213.  
  214. int same(char* a, char* b)
  215. {
  216.         int i;
  217.         for (i=0;;i++)
  218.         {
  219.                 if ((a[i]==0) && ((b[i]==0)))
  220.                         return 1;
  221.                 if ((a[i]==0) || ((b[i]==0)) || a[i]!=b[i])
  222.                         return 0;
  223.         }
  224. }
  225.  
  226. /*funciones publicas*/
  227.  
  228. char quecodigo(char* cadena)
  229. {
  230.         int i;
  231.  
  232.  
  233.  
  234.         for(i=0;i<148;i++)
  235.         {
  236.                 if (same(cadena,genres[i]))
  237.                         return i;
  238.         }
  239.         return 148;
  240. }
  241.  
  242. char* quegenero(unsigned char genero)
  243. {
  244.         if (genero<148)
  245.                 return genres[genero];
  246.         else
  247.                 return genres[148];
  248. }
  249.  
  250.  
  251. /*funciones privadas:*/
  252. void imprimirtags(tags_t *tags)
  253. {
  254.         char c;
  255.         int i;
  256.         printf("Artista: [");
  257.         for(i=0;caracterimprimible(c=tags->Artista[i])&&i<30;i++)
  258.                 putchar(c);
  259.         printf("]\n");
  260.         printf("Titulo de la cancion: [");
  261.         for(i=0;caracterimprimible(c=tags->Titulo[i])&&i<30;i++)
  262.                 putchar(c);
  263.         printf("]\n");
  264.         printf("Nombre del Album: [");
  265.         for(i=0;caracterimprimible(c=tags->Album[i])&&i<30;i++)
  266.                 putchar(c);
  267.         printf("]\n");
  268.  
  269.         if (tags->Ubyte==0)
  270.                 printf("# Pista: %i\n",(int) tags->NPista);
  271.         else
  272.                 printf("# Pista: []\n");
  273.  
  274.  
  275.         printf("A%co en que salio: [",164);
  276.         for(i=0;caracterimprimible(c=tags->Year[i])&&i<4;i++)
  277.                 putchar(c);
  278.         printf("]\n");
  279.         printf("Compositor: [");
  280.         for(i=0;caracterimprimible(c=tags->compositor[i])&&i<28;i++)
  281.                 putchar(c);
  282.         printf("]\n");
  283.  
  284.         printf("Genero: [%s]\n",quegenero(tags->genero));
  285.         printf("Cod de genero: 0x%X\n",tags->genero);
  286. }
  287.  
  288. void error(char *s)
  289. {
  290.         printf("error: %s",s);
  291.         //perror(s);
  292.         exit(-1);
  293. }
  294.  
  295. int volcar(tags_t *store, FILE *archivo)
  296. {
  297.  
  298.         int longcadena;
  299.         char cero[30]={};
  300.         fseek(archivo,-125,SEEK_END);
  301.  
  302.         longcadena=length(store->Titulo,30);
  303.         if (longcadena==0)
  304.                 fseek(archivo,30,SEEK_CUR);
  305.         else
  306.         {
  307.                 if(fwrite(store->Titulo, 1, longcadena, archivo)<=0)
  308.                         error("fwritetitulo1");
  309.                 if (longcadena!=30)
  310.                         if(fwrite(&cero, 1, 30-longcadena, archivo)<=0)
  311.                                 error("fwritetitulo2");
  312.                 //fflush(archivo);
  313.         }
  314.  
  315.  
  316.  
  317.         longcadena=length(store->Artista, 30);
  318.         if (longcadena==0)
  319.                 fseek(archivo,30,SEEK_CUR);
  320.         else
  321.         {
  322.                 if(fwrite(store->Artista, 1, longcadena, archivo)<=0)
  323.                         error("fwriteartista1");
  324.                 if (longcadena!=30)
  325.                         if(fwrite(&cero, 1, 30-longcadena, archivo)<=0)
  326.                                 error("fwriteartista2");
  327.                 //fflush(archivo);
  328.         }
  329.  
  330.  
  331.         longcadena=length(store->Album, 30);
  332.         if (longcadena==0)
  333.                 fseek(archivo,30,SEEK_CUR);
  334.         else
  335.         {
  336.                 if(fwrite(store->Album, 1, longcadena, archivo)<=0)
  337.                         error("fwritealbum1");
  338.                 if (longcadena!=30)
  339.                         if(fwrite(&cero, 1, 30-longcadena, archivo)<=0)
  340.                                 error("fwritealbum2");
  341.                 //fflush(archivo);
  342.         }
  343.  
  344.  
  345.         longcadena=length(store->Year, 4);
  346.         if (longcadena==0)
  347.                 fseek(archivo,4,SEEK_CUR);
  348.         else
  349.         {
  350.                 if(fwrite(store->Year, 1, longcadena, archivo)<=0)
  351.                         error("fwriteyear1");
  352.                 if (longcadena!=4)
  353.                         if(fwrite(&cero, 1, 4-longcadena, archivo)<=0)
  354.                                 error("fwriteyear2");
  355.                 //fflush(archivo);
  356.         }
  357.  
  358.         longcadena=length(store->compositor, 28);
  359.         if (longcadena==0)
  360.                 fseek(archivo,28,SEEK_CUR);
  361.         else
  362.         {
  363.                 if(fwrite(store->compositor, 1, longcadena, archivo)<=0)
  364.                         error("fwrite1compositor");
  365.                 if (longcadena!=28)
  366.                         if(fwrite(&cero, 1, 28-longcadena, archivo)<=0)
  367.                                 error("fwritecompositor2");
  368.                 //fflush(archivo);
  369.         }
  370.  
  371.         fputc(store->Ubyte,archivo);
  372.  
  373.         if (store->NPista==0)
  374.                 fseek(archivo,1,SEEK_CUR);
  375.         else
  376.                 fputc(store->NPista,archivo);
  377.  
  378.         if (store->genero==0)
  379.                 fseek(archivo,1,SEEK_CUR);
  380.         else
  381.                 fputc(store->genero,archivo);
  382.  
  383.         return 0;
  384. }
  385.  
  386. int volcar2(tags_t *store, FILE *archivo)
  387. {
  388.         int longcadena;
  389.         char cero[30]={}, tag[3]={'T','A','G'};
  390.         fseek(archivo,0, SEEK_END);
  391.  
  392.         if(fwrite(tag,1,3,archivo)<=0)
  393.                 error("fwriteTAG");
  394.  
  395.  
  396.  
  397.         longcadena=length(store->Titulo, 30);
  398.         if (longcadena!=0)
  399.                 if(fwrite(store->Titulo, 1, longcadena, archivo)<=0)
  400.                         error("fwritetitulo1");
  401.         if (longcadena!=30)
  402.                 if(fwrite(&cero, 1, 30-longcadena, archivo)<=0)
  403.                         error("fwritetitulo2");
  404.         //fflush(archivo);
  405.  
  406.         longcadena=length(store->Artista, 30);
  407.         if (longcadena!=0)
  408.                 if(fwrite(store->Artista, 1, longcadena, archivo)<=0)
  409.                         error("fwriteartista1");
  410.         if (longcadena!=30)
  411.                 if(fwrite(&cero, 1, 30-longcadena, archivo)<=0)
  412.                         error("fwriteartista2");
  413.         //fflush(archivo);
  414.  
  415.         longcadena=length(store->Album, 30);
  416.         if (longcadena!=0)
  417.                 if(fwrite(store->Album, 1, longcadena, archivo)<=0)
  418.                         error("fwritealbum1");
  419.         if (longcadena!=30)
  420.                 if(fwrite(&cero, 1, 30-longcadena, archivo)<=0)
  421.                         error("fwritealbum2");
  422.         //fflush(archivo);
  423.  
  424.         longcadena=length(store->Year, 4);
  425.         if (longcadena!=0)
  426.                 if(fwrite(store->Year, 1, longcadena, archivo)<=0)
  427.                         error("fwriteyear1");
  428.         if (longcadena!=4)
  429.                 if(fwrite(&cero, 1, 4-longcadena, archivo)<=0)
  430.                         error("fwriteyear2");
  431.         //fflush(archivo);
  432.  
  433.         longcadena=length(store->compositor, 28);
  434.         if (longcadena!=0)
  435.                 if(fwrite(store->compositor, 1, longcadena, archivo)<=0)
  436.                         error("fwritecompositor1");
  437.         if (longcadena!=28)
  438.                 if(fwrite(&cero, 1, 28-longcadena, archivo)<=0)
  439.                         error("fwritecompositor2");
  440.         //fflush(archivo);
  441.  
  442.         fputc(store->Ubyte,archivo);
  443.         fputc(store->NPista,archivo);
  444.         fputc(store->genero,archivo);
  445.  
  446.         return 0;
  447.  
  448. }
  449.  
  450. /*funcion writeTAGS (to file)*/
  451.  
  452. int writeTAGS(tags_t *store, FILE *archivo)
  453. {
  454.         char buf[3], tienetags=1;
  455.         fseek(archivo, -128, SEEK_END);
  456.         fread(buf, 1, 3, archivo);
  457.         if (buf[0]!='T' || buf[1]!='A' || buf[2]!='G')
  458.                         tienetags=0;
  459.  
  460.         if (tienetags)
  461.         {
  462.                 if(volcar(store, archivo)<0)
  463.                         return -1;
  464.         }
  465.         else
  466.                 if(volcar2(store,archivo)<0)
  467.                         return -1;
  468.         return 0;
  469.  
  470. }
  471.  
  472. /*Escritura de los tags*/
  473.  
  474. int writeartist(tags_t *store, char *cadena)
  475. {
  476.         int i, j;
  477.         for(i=0; i<30 && cadena[i]!=0;i++ )
  478.                 store->Artista[i]=cadena[i];
  479.         for(j=i;j<(30-i);j++)
  480.                 store->Artista[j]=0;
  481.         return 0;
  482. }
  483.  
  484. int writetitle(tags_t *store, char *cadena)
  485. {
  486.         int i, j;
  487.         for(i=0; i<30 && cadena[i]!=0;i++ )
  488.                 store->Titulo[i]=cadena[i];
  489.         for(j=i;j<(30-i);j++)
  490.                 store->Titulo[j]=0;
  491.         return 0;
  492. }
  493.  
  494. int writealbum(tags_t *store, char *cadena)
  495. {
  496.         int i, j;
  497.         for(i=0; i<30 && cadena[i]!=0;i++ )
  498.                 store->Album[i]=cadena[i];
  499.         for(j=i;j<(30-i);j++)
  500.                 store->Album[j]=0;
  501.         return 0;
  502. }
  503.  
  504. int writeyear(tags_t *store, char *cadena)
  505. {
  506.         int i, j;
  507.         for(i=0; i<4 && cadena[i]!=0;i++ )
  508.                 store->Year[i]=cadena[i];
  509.         for(j=i;j<(4-i);j++)
  510.                 store->Year[j]=0;
  511.         return 0;
  512. }
  513.  
  514. int writecoment(tags_t *store, char *cadena)
  515. {
  516.         int i, j;
  517.         for(i=0; i<28 && cadena[i]!=0;i++ )
  518.                 store->compositor[i]=cadena[i];
  519.         for(j=i;j<(28-i);j++)
  520.                 store->compositor[j]=0;
  521.         return 0;
  522. }
  523.  
  524. int writegenre(tags_t *store, char cadena)
  525. {
  526.         store->genero=cadena;
  527.         return 0;
  528. }
  529.  
  530. int writetrack(tags_t *store, char cadena)
  531. {
  532.         store->Ubyte=0;
  533.         store->NPista=cadena;
  534.         return 0;
  535. }
  536.  
  537. /* Lectura de los tags*/
  538.  
  539. int readartist(tags_t *store, char *cadena)
  540. {
  541.         int i, j;
  542.         for(i=0; i<30 && caracterimprimible(store->Artista[i]);i++ )
  543.                 cadena[i]=store->Artista[i];
  544.         for(j=i;j<(31-i);j++)
  545.                 cadena[i]=0;
  546.         return 0;
  547. }
  548.  
  549. int readtitle(tags_t *store, char *cadena)
  550. {
  551.         int i, j;
  552.         for(i=0; i<30 && caracterimprimible(store->Titulo[i]);i++ )
  553.                 cadena[i]=store->Titulo[i];
  554.         for(j=i;j<(31-i);j++)
  555.                 cadena[i]=0;
  556.         return 0;
  557. }
  558.  
  559. int readalbum(tags_t *store, char *cadena)
  560. {
  561.         int i, j;
  562.         for(i=0; i<30 && caracterimprimible(store->Album[i]);i++ )
  563.                 cadena[i]=store->Album[i];
  564.         for(j=i;j<(31-i);j++)
  565.                 cadena[i]=0;
  566.         return 0;
  567. }
  568.  
  569. int readyear(tags_t *store, char *cadena)
  570. {
  571.         int i, j;
  572.         for(i=0; i<4 && caracterimprimible(store->Year[i]);i++ )
  573.                 cadena[i]=store->Year[i];
  574.         for(j=i;j<(5-i);j++)
  575.                 cadena[i]=0;
  576.         return 0;
  577. }
  578.  
  579. int readcoment(tags_t *store, char *cadena)
  580. {
  581.         int i, j;
  582.         for(i=0; i<28 && caracterimprimible(store->compositor[i]);i++ )
  583.                 cadena[i]=store->compositor[i];
  584.         for(j=i;j<(2+-i);j++)
  585.                 cadena[i]=0;
  586.         return 0;
  587. }
  588.  
  589. int readgenre(tags_t *store, char *c)
  590. {
  591.         *c=store->genero;
  592.         return 0;
  593. }
  594.  
  595. int readtrack(tags_t *store, char *c)
  596. {
  597.         if (store->Ubyte!=0)
  598.                 *c=store->NPista;
  599.         else
  600.                 *c=-1;
  601.         return 0;
  602. }
  603.  
  604. /*funcion readtags (from file)*/
  605.  
  606. int readTAGS(tags_t *store, FILE *archivo)
  607. {
  608.         char buf[3];
  609.         fseek(archivo, -128, SEEK_END);
  610.  
  611.         fread(buf, 1, 3, archivo);
  612.         if (buf[0]!='T' || buf[1]!='A' || buf[2]!='G')
  613.                 return -1;
  614.  
  615.         fread(store, 1, 125, archivo);
  616.         return 0;
  617. }
  618.  
  619. /*
  620. int eliminarTAGS(FILE *archivo)
  621. {
  622.         char buf[3];
  623.         fseek(archivo, -128, SEEK_END);
  624.         fread(buf, 1, 3, archivo);
  625.         if (buf[0]!='T' || buf[1]!='A' || buf[2]!='G')
  626.                 return -1;
  627.  
  628.         return 0;
  629. }*/
  630.  
  631.  
  632.  
  633. int main(int argc, char** argv)
  634. {
  635.         FILE *archivo, *archivo2;
  636.         int a;
  637.         char* filename="aa.mp3", path2;
  638.         char artista[1024];
  639.         tags_t *tags;
  640.  
  641.  
  642.         tags = malloc(sizeof(tags_t));
  643.  
  644.         if ((archivo = fopen(filename,"rb+"))==NULL)
  645.                 error("fopen");
  646.  
  647.         readTAGS(tags, archivo);
  648.  
  649.  
  650.         imprimirtags(tags);
  651.  
  652.         readtitle(tags, artista);
  653.         printf("\n titulo:{%s}\n", artista);
  654.  
  655.  
  656.  
  657.         if((a=fclose(archivo))!=0)
  658.                 error("fclose");
  659.         return 0;
  660.  
  661.  
  662. }