As a corollary to my last post, it’s important to be careful when calculating file seek positions (if you’re skipping around that way). It turns out it’s necessary to cast all of the numbers being used when calculating a seek position to a large integer, such as
unsigned long int.
By the way, Rob had some helpful comments on that last post. (Thanks Rob!)