S
Sudip
I'm new in c programming. I am writing a program which reads the ID3 V1
tag from a mp3 file and edits it. But everytime i try to take inputs ,
the first character of my album contains 0. So, it doesn't write
anything at the start of album field. So, winamp cannot recognize the
album name. Can someone pls help me? :-(
The code for tag input and edit is:
void edittag(long loc,char name[]){
FILE *fp;
char song[30],artist[30],album[30],year[4],comment[28],track;
char genre;
int i,j;
for(i=0;i<30;i++){
song=0;
artist=0;
album=0;
}
for(j=0;j<28;j++){
comment[j]=0;
}
fflush(stdin);
printf("\nTitle: ");
gets(song);
printf("\nArtist: ");
gets(artist);
printf("\nAlbum: ");
gets(album);
printf("\nYear: ");
gets(year);
printf("\nComment: ");
gets(comment);
printf("\nTrack: ");
scanf("%d",&track);
printf("\nGenre: ");
scanf("%d",&genre);
fp=fopen(name,"rb+");
for(i=loc-125,j=0;i<loc-95,j<30;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(song[j],fp);
}
for(i=loc-95,j=0;i<loc-65,j<30;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(artist[j],fp);
}
for(i=loc-65,j=0;i<loc-35,j<30;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(album[j],fp);
}
for(i=loc-35,j=0;i<loc-31,j<4;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(year[j],fp);
}
for(i=loc-31,j=0;i<loc-3,j<28;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(comment[j],fp);
}
fseek(fp,loc-3,SEEK_SET);
fputc(00,fp);
fseek(fp,loc-2,SEEK_SET);
fputc(track,fp);
fseek(fp,loc-1,SEEK_SET);
fputc(genre,fp);
}
pls someone help me. :-(
tag from a mp3 file and edits it. But everytime i try to take inputs ,
the first character of my album contains 0. So, it doesn't write
anything at the start of album field. So, winamp cannot recognize the
album name. Can someone pls help me? :-(
The code for tag input and edit is:
void edittag(long loc,char name[]){
FILE *fp;
char song[30],artist[30],album[30],year[4],comment[28],track;
char genre;
int i,j;
for(i=0;i<30;i++){
song=0;
artist=0;
album=0;
}
for(j=0;j<28;j++){
comment[j]=0;
}
fflush(stdin);
printf("\nTitle: ");
gets(song);
printf("\nArtist: ");
gets(artist);
printf("\nAlbum: ");
gets(album);
printf("\nYear: ");
gets(year);
printf("\nComment: ");
gets(comment);
printf("\nTrack: ");
scanf("%d",&track);
printf("\nGenre: ");
scanf("%d",&genre);
fp=fopen(name,"rb+");
for(i=loc-125,j=0;i<loc-95,j<30;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(song[j],fp);
}
for(i=loc-95,j=0;i<loc-65,j<30;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(artist[j],fp);
}
for(i=loc-65,j=0;i<loc-35,j<30;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(album[j],fp);
}
for(i=loc-35,j=0;i<loc-31,j<4;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(year[j],fp);
}
for(i=loc-31,j=0;i<loc-3,j<28;i++,j++){
fseek(fp,i,SEEK_SET);
fputc(comment[j],fp);
}
fseek(fp,loc-3,SEEK_SET);
fputc(00,fp);
fseek(fp,loc-2,SEEK_SET);
fputc(track,fp);
fseek(fp,loc-1,SEEK_SET);
fputc(genre,fp);
}
pls someone help me. :-(