I am stuck with a weird problem that i am not able to understand.
I am trying to make a utility in C language that extracts a part of an MP3 file and writes it to an output file.
What i am currently doing is that i open the input file using _open() in binary mode and read the file byte by byte using _read(). However when it reads byte 1Ah (26 in decimal), _read() returns 0 indicating End Of File. This byte is the 103rd byte in the file, which is almost the start of file, so it is actually not the end of file. The file itself is of size 2.89 MB.
Secondly, EOF is defined as -1 not 26. So why is _read() indicating EOF.
By the way i have also tried fread() but it also has the same problem.
I am using MS Visual Studio 2000 under Windows XP.
Please suggest some solution as this problem is driving me crazy.