--- Andreas Holz <asholz(a)topinform.com> wrote:
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);
I'm not Christopher, but I do have an answer: 2BSD is older
than POSIX. It's also older than ANSI C. If I had to guess
(not having 2BSD sources in front of me), I'd expect the
prototype for read() to be:
int read(int filedes, char *buf, int nbyte); **
Back in the K&R days, people were loose with I/O buffer declaration,
pointer casting, etc. What he's doing there is telling read() to fill
his int 'reclen' with four bytes from the input stream. I'm sure it works
for him in his environment, but I wouldn't call it a portable solution.
Are these ".tap" files some kind of a
standard format?
I am familiar with .tap files from the Commodore world - specifically
as input to VICE. I wouldn't know if these .tap files are compatible
or not without some code inspection.
Background: I got some files which are claiming to be
in a ".tap" format
and I would like to write the to tape!
Do you know what tool created them? That might be helpful to know.
-ethan
** - According to K&R, 1st ed., section 8.2, p. 160, it simply
describes read as "n_read = read(fd, buf, n)" and goes on to
use them with n_read declared as a int, buf declared as char[],
and n defined as a constant.