Hi, im trying to write some information into a mp3 file. The information i'm trying to introduce into the file must begin 128 bytes from the end of the file, and this block of information is identified by the string "TAG" at that position (128 bytes from the end).
After those 3 bytes, we have a 30 byte space for each one of these strings: title,artist name, album, a 4 byte slot for the year, and comment.
The sum of all these slots is 127, so that the information to be written can fit the file.
Thing is, it isnt writing anything into the file...not even those crucial 3 bytes. Here's the code:
void TagCmd::create_tag(Mp3& mp3){
const char * name = mp3.Getname();
fstream file(name, ios::out | ios::in | ios::binary);
char * tag = "TAG";
char * tit = "<Song Title>";
char * art = "<Artist Name>";
char * alb = "<Album Name>";
char * jahre = 0;
char * comment = "<Comment>";
char * test = new char[4];
//char c;
file.seekp(-128,ios::end);
file.write("TAG",3);
file.write(tit,30);
file.write(art,30);
file.write(alb,30);
file.write(jahre,4);
file.write(comment,30);
file.seekg(-128,ios::end);
file.read(test,4);
printf("coiz: %s\n",test);
file.close();
}
It would be great if u guys could give me a hint here. Thanks again :)