Gracias, ya he visto todas las páginas anteriores y más, el todo es que no sé modificar aún eso.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCita de: MCKSys Argentina en 17 Mayo 2017, 20:16 PMAmmm... No entiendo, cómo se usa?
Quizás no es lo que buscas, pero dispones de una lib para modificar los tags.
Lo bueno es que es open source y puedes mirar cómo ha resuelto el tema el programador: https://sourceforge.net/projects/id3lib/files/id3lib/
Source: http://stackoverflow.com/questions/19928569/id3v2-tag-for-mp3-using-c
Espero te sea de utilidad.
Saludos!
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
//-------------------------------------------------------------------------
typedef unsigned char byte;
typedef unsigned int uint;
typedef struct synch {
byte b3,b2,b1,b0;
} sint;
//-------------------------------------------------------------------------
struct header
{
char mark[3];
byte version[2];
byte flags;
sint size;
};
//-------------------------------------------------------------------------
struct frame
{
char id[4];
sint size;
byte flags[2];
};
//-------------------------------------------------------------------------
uint usych(sint value)
{
return value.b0|value.b1<<8|value.b2<<16|value.b3<<24;
}
//-------------------------------------------------------------------------
int main()
{
FILE *file=fopen("D:/Programacion/P1/ID3/cancion.mp3","r");
if(!file)
{
cout<<"File not found"<<endl;
return 0;
}
header hd;
fread(&hd,10,1,file);
if(strncmp(hd.mark,"ID3",3)!=0)
{
cout << "This file hasn't TAG" << endl;
fclose(file);
return 0;
}
cout << "Version : "<< (int)hd.version[0]<<"."<<(int)hd.version[1] << endl;
cout << "Flags : "<< (int)hd.flags << endl;
cout << "size : " << usych(hd.size)<< endl;
if(hd.version[0] < 3)
{
cout<<"Version doesn't match"<< endl;
fclose(file);
return 0;
}
char buffer;
while(true)
{
frame fr;
fread(&fr,10,1,file);
if(fr.id[0]<'A')break;
cout << endl << fr.id[0] << fr.id[1] << fr.id[2] << fr.id[3];
cout <<" "<< usych(fr.size)<<" bytes... ";
if(fr.id[0]!='T'){
fseek(file,usych(fr.size),SEEK_CUR);
cout << "(Empty)" << endl;
}else{
cout << "(";
for(uint i=0;i<usych(fr.size);i++)
{
fread(&buffer,1,1,file);
if(buffer >= 32 && buffer <=126){
cout << buffer;
}
}
cout << ")" << endl;
}
}
cout << endl;
fclose(file);
return 0;
}
#include <iostream>
#include <locale.h>
#include <string>
using namespace std;
//----------------------------------------------------------------------------------------------------------
string val(string n)
{
string c, p;
int i;
//
for (i = 0; i <= 10; i++)
{
c = n.at(i);
if (c != "0" && c != "1" && c != "2" && c != "3" && c != "4" && c != "5" && c != "6" && c != "7" && c != "8" && c != "9")
{
p = "0";
}
break;
}
return p;
}
//----------------------------------------------------------------------------------------------------------
void Units(string n)
{
if (n == "0") cout << "zero"; else
if (n == "1") cout << "one"; else
if (n == "2") cout << "two"; else
if (n == "3") cout << "three"; else
if (n == "4") cout << "four"; else
if (n == "5") cout << "five"; else
if (n == "6") cout << "six"; else
if (n == "7") cout << "seven"; else
if (n == "8") cout << "eight"; else
if (n == "9") cout << "nine";
}
//----------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------
void Tens(string n)
{
char t = n.at(0);
char u = n.at(1);
n = n.substr(1, 1);
//
if (t == '0' && u != '0')
{
Units(n);
}
if (t == '1')
{
if (u == '0') cout << "ten"; else
if (u == '1') cout << "eleven"; else
if (u == '2') cout << "twelve"; else
if (u == '3') cout << "thirteen"; else
if (u == '4') cout << "fourteen"; else
if (u == '5') cout << "fifteen";
else
{
Units(n);
cout << "teen";
}
}
if (t == '2')
{
if (u == '0') cout << "twenty";
else
{
cout << "twenty- ";
Units(n);
}
}
if (t == '3')
{
if (u == '0') cout << "thirty";
else
{
cout << "thirty-";
Units(n);
}
}
if (t == '4')
{
if (6u == '0') cout << "forty";
else
{
cout << "forty- ";
Units(n);
}
}
if (t == '5')
{
if (u == '0') cout << "fifty";
else
{
cout << "fifty-";
Units(n);
}
}
if (t == '6')
{
if (u == '0') cout << "sixty";
else
{
cout << "sixty-";
Units(n);
}
}
if (t == '7')
{
if (u == '0') cout << "seventy";
else
{
cout << "seventy-";
Units(n);
}
}
if (t == '8')
{
if (u == '0') cout << "eighty";
else
{
cout << "eighty-";
Units(n);
}
}
if (t == '9')
{
if (u == '0') cout << "ninety";
else
{
cout << "ninety-";
Units(n);
}
}
}
//--------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------
void Hundreds(string n)
{
char t = n.at(0);
char u = n.at(1);
char v = n.at(2);
n = n.substr(1, 2);
if (t == '0')
{
Tens(n);
}
if (t == '1')
{
if (u == '0'&& v == '0') cout << "One hundred";
else
{
cout << "One hundred and ";
Tens(n);
}
}
if (t == '2')
{
if (u == '0'&& v == '0') cout << "Two hundred";
else
{
cout << "Two hundred and ";
Tens(n);
}
}
if (t == '3')
{
if (u == '0'&& v == '0') cout << "Three hundred";
else
{
cout << "Three hundred and ";
Tens(n);
}
}
if (t == '4')
{
if (u == '0'&& v == '0') cout << "Four hundred";
else
{
cout << "Four hundred and ";
Tens(n);
}
}
if (t == '5')
{
if (u == '0'&& v == '0') cout << "Five hundred";
else
{
cout << "Five hundred and ";
Tens(n);
}
}
if (t == '6')
{
if (u == '0'&& v == '0') cout << "Six hundred";
else
{
cout << "Six hundred and ";
Tens(n);
}
}
if (t == '7')
{
if (u == '0'&& v == '0') cout << "Seven hundred";
else
{
cout << "Seven hundred and ";
Tens(n);
}
}
if (t == '8')
{
if (u == '0'&& v == '0') cout << "Eight hundred";
else
{
cout << "Eight hundred and ";
Tens(n);
}
}
if (t == '9')
{
if (u == '0'&& v == '0') cout << "Nine hundred";
else
{
cout << "Nine hundred and ";
Tens(n);
}
}
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------------
void Thousands(string n)
{
char t = n.at(0);
char u = n.at(1);
char v = n.at(2);
char w = n.at(3);
n = n.substr(1, 3);
if (t == '0')
{
Hundreds(n);
}
if (t == '1')
{
if (u == '0' && v == '0'&& w == '0') cout << "One thousand";
else
{
cout << "One thousand ";
Hundreds(n);
}
}
if (t == '2')
{
if (u == '0' && v == '0'&& w == '0') cout << "Two thousand";
else
{
cout << "Two thousand ";
Hundreds(n);
}
}
if (t == '3')
{
if (u == '0' && v == '0'&& w == '0') cout << "three thousand";
else
{
cout << "three thousand ";
Hundreds(n);
}
}
if (t == '4')
{
if (u == '0' && v == '0'&& w == '0') cout << "four thousand";
else
{
cout << "four thousand ";
Hundreds(n);
}
}
if (t == '5')
{
if (u == '0' && v == '0'&& w == '0') cout << "five thousand";
else
{
cout << "five thousand ";
Hundreds(n);
}
}
if (t == '6')
{
if (u == '0' && v == '0'&& w == '0') cout << "six thousand";
else
{
cout << "six thousand ";
Hundreds(n);
}
}
if (t == '7')
{
if (u == '0' && v == '0'&& w == '0') cout << "seven thousand";
else
{
cout << "seven thousand ";
Hundreds(n);
}
}
if (t == '8')
{
if (u == '0' && v == '0'&& w == '0') cout << "eight thousand";
else
{
cout << "eight thousand ";
Hundreds(n);
}
}
if (t == '9')
{
if (u == '0' && v == '0'&& w == '0') cout << "nine thousand";
else
{
cout << "nine thousand ";
Hundreds(n);
}
}
}
//--------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------
void Thousands2(string n)
{
char t = n.at(0);
char u = n.at(1);
char v = n.at(2);
char w = n.at(3);
char x = n.at(4);
n = n.substr(1, 4);
if (t == '0')
{
Thousands(n);
}
if (t == '1')
{
string temp = "";
temp.resize(10);
temp[0] = t;
temp[1] = u;
temp[2] = v;
temp[3] = w;
temp[4] = x;
Tens(temp);
cout << " thousand ";
temp = &temp[2];
Hundreds(temp);
return;
}
if (t == '2')
{
if (u == '0' && v == '0'&& w == '0' && x == '0') cout << "twenty thousand";
else
{
cout << "twenty-";
Thousands(n);
}
}
if (t == '3')
{
if (u == '0' && v == '0'&& w == '0' && x == '0') cout << "thirty thousand";
else
{
cout << "thirty-";
Thousands(n);
}
}
if (t == '4')
{
if (u == '0' && v == '0'&& w == '0' && x == '0') cout << "forty thousand";
else
{
cout << "forty-";
Thousands(n);
}
}
if (t == '5')
{
if (u == '0' && v == '0'&& w == '0' && x == '0') cout << "fifty thousand";
else
{
cout << "fifty-";
Thousands(n);
}
}
if (t == '6')
{
if (u == '0' && v == '0'&& w == '0' && x == '0') cout << "sixty thousand";
else
{
cout << "sixty-";
Thousands(n);
}
}
if (t == '7')
{
if (u == '0' && v == '0'&& w == '0' && x == '0') cout << "seventy thousand";
else
{
cout << "seventy-";
Thousands(n);
}
}
if (t == '8')
{
if (u == '0' && v == '0'&& w == '0' && x == '0') cout << "eighty thousand";
else
{
cout << "eighty-";
Thousands(n);
}
}
if (t == '9')
{
if (u == '0' && v == '0'&& w == '0' && x == '0') cout << "ninety thousand";
else
{
cout << "ninety-";
Thousands(n);
}
}
}
//-----------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------
void Thousands3(string n)
{
char t = n.at(0);
char u = n.at(1);
char v = n.at(2);
char w = n.at(3);
char x = n.at(4);
char y = n.at(5);
n = n.substr(1, 5);
if (t == '0')
{
Thousands2(n);
}
if (t == '1')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0') cout << "one hundred thousand ";
else
{
cout << "one hundred and ";
Thousands2(n);
}
}
if (t == '2')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0') cout << "two hundred thousand ";
else
{
cout << "two hundred and ";
Thousands2(n);
}
}
if (t == '3')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0') cout << "three hundred thousand";
else
{
cout << "three hundred and ";
Thousands2(n);
}
}
if (t == '4')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0') cout << "four hundred thousand";
else
{
cout << "four hundred and ";
Thousands2(n);
}
}
if (t == '5')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0') cout << "five hundred thousand";
else
{
cout << "five hundred and ";
Thousands2(n);
}
}
if (t == '6')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0') cout << "six hundred thousand";
else
{
cout << "six hundred and ";
Thousands2(n);
}
}
if (t == '7')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0') cout << "seven hundred thousand";
else
{
cout << "seven hundred and ";
Thousands2(n);
}
}
if (t == '8')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0') cout << "eight hundred thousand";
else
{
cout << "eight hundred and ";
Thousands2(n);
}
}
if (t == '9')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0') cout << "nine hundred thousand";
else
{
cout << "nine hundred and ";
Thousands2(n);
}
}
}
//-----------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------
void Millions(string n)
{
char t = n.at(0);
char u = n.at(1);
char v = n.at(2);
char w = n.at(3);
char x = n.at(4);
char y = n.at(5);
char z = n.at(6);
n = n.substr(1, 6);
if (t == '0')
{
Thousands3(n);
}
if (t == '1')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0') cout << "one million ";
else
{
cout << "one million, ";
Thousands3(n);
}
}
if (t == '2')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0') cout << "two million ";
else
{
cout << "two million, ";
Thousands3(n);
}
}
if (t == '3')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0') cout << "three million";
else
{
cout << "three million, ";
Thousands3(n);
}
}
if (t == '4')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0') cout << "four million";
else
{
cout << "four million, ";
Thousands3(n);
}
}
if (t == '5')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0') cout << "five million";
else
{
cout << "five million, ";
Thousands3(n);
}
}
if (t == '6')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0') cout << "six million";
else
{
cout << "six million, ";
Thousands3(n);
}
}
if (t == '7')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0') cout << "seven million";
else
{
cout << "seven million, ";
Thousands3(n);
}
}
if (t == '8')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0') cout << "eight million";
else
{
cout << "eight million, ";
Thousands3(n);
}
}
if (t == '9')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0') cout << "nine million";
else
{
cout << "nine million, ";
Thousands3(n);
}
}
}
//-----------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------
void Millions2(string n)
{
char t = n.at(0);
char u = n.at(1);
char v = n.at(2);
char w = n.at(3);
char x = n.at(4);
char y = n.at(5);
char z = n.at(6);
char z2 = n.at(7);
n = n.substr(1, 7);
if (t == '0')
{
Millions(n);
}
if (t == '1')
{//11
string temp = "";//112000
temp.resize(10);
temp[0] = t;
temp[1] = u;
temp[2] = v;
temp[3] = w;
temp[4] = x;
temp[5] = y;
temp[6] = z;
temp[7] = z2;
Tens(temp);
cout << " million ";
temp = &temp[2];//12000000
Thousands3(temp);
return;
}
if (t == '2')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0') cout << "twenty million ";
else
{
cout << "twenty million ";
Millions(n);
}
}
if (t == '3')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0') cout << "thirty million";
else
{
cout << "thirty million ";
Millions(n);
}
}
if (t == '4')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0') cout << "forty million";
else
{
cout << "forty million ";
Millions(n);
}
}
if (t == '5')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0') cout << "fifty million";
else
{
cout << "fifty million ";
Millions(n);
}
}
if (t == '6')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0') cout << "sixty million";
else
{
cout << "sixty million ";
Millions(n);
}
}
if (t == '7')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0') cout << "seventy million";
else
{
cout << "seventy million ";
Millions(n);
}
}
if (t == '8')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0') cout << "eighty million";
else
{
cout << "eighty million ";
Millions(n);
}
}
if (t == '9')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0') cout << "ninety million";
else
{
cout << "ninety million ";
Millions(n);
}
}
}
//-----------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------
void Millions3(string n)
{
char t = n.at(0);
char u = n.at(1);
char v = n.at(2);
char w = n.at(3);
char x = n.at(4);
char y = n.at(5);
char z = n.at(6);
char z2 = n.at(7);
char z3 = n.at(8);
n = n.substr(1, 8);
if (t == '0')
{
Millions2(n);
}
if (t == '1')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0') cout << "one hundred million ";
else
{
cout << "one hundred and ";
Millions2(n);
}
}
if (t == '2')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0') cout << "two hundred million ";
else
{
cout << "two hundred and ";
Millions2(n);
}
}
if (t == '3')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0') cout << "three hundred million";
else
{
cout << "three hundred and ";
Millions2(n);
}
}
if (t == '4')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0') cout << "four hundred million";
else
{
cout << "four hundred and ";
Millions2(n);
}
}
if (t == '5')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0') cout << "five hundred million";
else
{
cout << "five hundred and ";
Millions2(n);
}
}
if (t == '6')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0') cout << "six hundred million";
else
{
cout << "six hundred and ";
Millions2(n);
}
}
if (t == '7')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0') cout << "seven hundred million";
else
{
cout << "seven hundred and ";
Millions2(n);
}
}
if (t == '8')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0') cout << "eight hundred million";
else
{
cout << "eight hundred and ";
Millions2(n);
}
}
if (t == '9')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0') cout << "nine hundred million";
else
{
cout << "nine hundred and ";
Millions2(n);
}
}
}
//-----------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------
void Millions4(string n)
{
char t = n.at(0);
char u = n.at(1);
char v = n.at(2);
char w = n.at(3);
char x = n.at(4);
char y = n.at(5);
char z = n.at(6);
char z2 = n.at(7);
char z3 = n.at(8);
char z4 = n.at(8);
n = n.substr(1, 9);
if (t == '0')
{
Millions3(n);
}
if (t == '1')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0' && z4 == '0') cout << "one billion ";
else
{
cout << "one billion, ";
Millions3(n);
}
}
if (t == '2')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0' && z4 == '0') cout << "two billion ";
else
{
cout << "two billion, ";
Millions3(n);
}
}
if (t == '3')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0' && z4 == '0') cout << "three billion";
else
{
cout << "three billion, ";
Millions3(n);
}
}
if (t == '4')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0' && z4 == '0') cout << "four billion";
else
{
cout << "four billion, ";
Millions3(n);
}
}
if (t == '5')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0' && z4 == '0') cout << "five billion";
else
{
cout << "five billion, ";
Millions3(n);
}
}
if (t == '6')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0' && z4 == '0') cout << "six billion";
else
{
cout << "six billion, ";
Millions3(n);
}
}
if (t == '7')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0' && z4 == '0') cout << "seven billion";
else
{
cout << "seven billion, ";
Millions3(n);
}
}
if (t == '8')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0' && z4 == '0') cout << "eight billion";
else
{
cout << "eight billion, ";
Millions3(n);
}
}
if (t == '9')
{
if (u == '0' && v == '0'&& w == '0' && x == '0' && y == '0' && z == '0' && z2 == '0' && z3 == '0' && z4 == '0') cout << "nine billion";
else
{
cout << "nine billion, ";
Millions3(n);
}
}
}
//-----------------------------------------------------------------------------------------------------------------------
int main()
{
int i, c;
string num, n, r, g;
//
cout << "===============================\n";
cout << "= Convert numbers to letters =\n";
cout << "===============================\n\n";
do
{
do
{
cout << "Type a number up to 10 digits to convert in Written English: "; getline(cin, n);
c = n.size();
if (c == NULL) g = "0";
else g = val(n);
} while (c > 10 || g == "0");
switch (n.length())
{
case 1: Units(n); break;
case 2: Tens(n); break;
case 3: Hundreds(n); break;
case 4: Thousands(n); break;
case 5: Thousands2(n); break;
case 6: Thousands3(n); break;
case 7: Millions(n); break;
case 8: Millions2(n); break;
case 9: Millions3(n); break;
case 10: Millions4(n); break;
}
cout << endl;
cout << "Another number?:(Y/N) "; getline(cin, r);
} while (r == "y" || r == "Y");
cout << "\n\nHOMEWORK # 2\nAuthor: Giancarlo Rosero Portillo\nto: Jesus Insuasti\n";
system("pause");
return 0;
}