FILE* fpi = 0;
char *albumart = 0;
char *filename = "ty.jpg";
size_t size;
fopen(&fpi, filename, "rb, IMG= encoding ");
size = fseek(fpi, SEEK_END, SEEK_SET);
fread(albumart,(char), size, fpi);
id3tag_set_albumart(lame, albumart, size);
free(albumart);
fclose(fpi);
Parameters
--------------------------------------------------------------------------------
buffer = Storage location for data.
size = Item size in bytes.
count = Maximum number of items to be read.
stream = Pointer to FILE structure.
size_t = Return Value
--------------------------------------------------------------------------------
fread returns the number of full items actually read, which may be less than count if an error occurs or if the end of the file is encountered before reaching count. Use the feof or ferror function to distinguish a read error from an end-of-file condition. If size or count is 0, fread returns 0 and the buffer contents are unchanged. If stream or buffer is a null pointer, fread invokes the invalid parameter handler, as described in Parameter Validation. If execution is allowed to continue, this function sets errno to EINVAL and returns 0.
------------------------------------------------------------------------------------
AND if your are only getting a value of 4, for sizeof(fpi), then you didn't open the file, or read it.