: : I been trying to write a program that open the file C:\mp3.mp3 and
: : prints the last 128 bytes of the file which would be the id3 tag v1.
: : So far it's been an epic fail =(
: :
:
: Would something like this do the trick? (NB! I didn't write any
: error checking, do it yourself)
:
:
: #include <stdio.h>
: #include <string.h>
:
: int main() {
: int bufLength=129;
: FILE* f=fopen("C:\\mp3.mp3", "rb");
: fseek(f, 0, SEEK_END);
: long fileLength=ftell(f);
: fseek(f, fileLength-bufLength+1, SEEK_SET);
:
: char buffer[bufLength];
: memset(buffer, 0, bufLength);
: fread(buffer, 1, bufLength-1, f);
: for(int i=0; i<bufLength; i++) {
: printf("%c", buffer[i]);
: }
: printf("\n");
: fclose(f);
: return 0;
: }
: :
:
thank you, appreciate the help