Hi ~
I found this code on Planet Source Code. It performs some file I/O to read ID3 tags in MP3 files. Here it is:
Code:
class ID3struct
{
public:
char TID[3];
char title[30];
char artist[30];
char album[30];
char year[4];
char comment[30];
BYTE genre;
}
ID3Data;
{
HANDLE hFile;
DWORD read;
char ID3[128];
hFile = CreateFile("bond.mp3", // file to read
GENERIC_READ, // open for reading
0, // do not share
NULL,// default security
OPEN_EXISTING, // open file if exists
FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attr. template
SetFilePointer(hFile, -128, NULL, FILE_END);
ReadFile(hFile, ID3, 128, &read, NULL);
CloseHandle(hFile);
memcpy(&ID3Data, ID3, 128);
}
I don't actually understand anything that is going on here... I wonder if anyone could herlp me put this into fstream? (i.e. using #include <fstream.h>)
Thankyou so much, I hope that this isn't too much to ask...
~ Chris Howarth