You can do it manually by scanning for the mp3 header in each frame, then calculating the frame sized based on the bitrate and samplerate you read from each header and summing up the lengths of each frame. If you know it is a CBR file you can just do it for one header and trust that the frames don't vary. If it is VBR than you must check each frame if you want a reliable length. There is one catch and that is sometimes frames use padding and that will mess with these calculations a bit.
Hope it helps