Yesterday i builded an id3 tag reader for mp3 files. I used a php class i've written before as base.
The first thing you have to do in order to read the tags is to check if it's id3v1 or id3v2. To do so, you read the first 10 characters of the file.
No here's my problem: when i open the file and read the first 10 characters, only 9 are returned.
this is the code i'm using:
It works for 60% of the mp3 files, but with certain files, it only reads 9 characters, even when i attempt to read 50 characters.
Is there a byte character that stops the reading of the file (mp3 is ascii encoded)?
Ow yes: it works fine with all files when i use my php class
EDIT: when i print the ord of every single character, i get an error that the thenth character is a string of length 0
But when i open the file in wordpad, it shows a character on position 10
EDIT 2: i've found it: i just had to open the file in binary mode, not text mode. This is done by adding a "b" to the open-mode:
Thanx anyway,
UnrealEd