Converting .tap files to real tapes

From: Sean 'Captain Napalm' Conner <spc_at_conman.org>
Date: Wed Jun 18 14:08:01 2003

It was thus said that the Great Andreas Holz once stated:
>
> Christopher,
>
> some questions to your program:
>
> what does the statement do:
>
> read(infile,&reclen,4); ?
>
> this syntax does not conform to UNIX (POSIX) read (e.g. HP/UX):
>
> ssize_t read(int filedes, void *buf, size_t nbyte);

  It does. It reads in four bytes from infile and stores them in reclen (of
which a pointer is given to read() and in ANSI C, any pointer can be cast to
void *). The bug lies in how integers are written. If, for instance, the
data was written on a little-endian system and then you attempt to read on a
big-endian system you are not going to get consistent results. You need to
ensure a consistent ordering of bytes.

  -spc (htonl() and ntohl() are your friends 8-)
Received on Wed Jun 18 2003 - 14:08:01 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:36:08 BST