If you're trying to read a pcap-format file, it's probably a lot
easier if you use, well, *pcap* (libpcap on UN*X, WinPcap on Windows)
- it already supports reading those files, and handles byte order,
etc. issues for you. pcap's usable from C and C++, at least, and
there exist modules for many of the interpreted languages out there
for it (e.g., Net::Pcap for Perl).