Subject: Re: Block size on tape WAS :Re: TK50
To: emanuel stiebler <emu@ecubics.com>
From: David Evans <dfevans@bbcr.uwaterloo.ca>
List: port-vax
Date: 06/08/2000 11:42:46
emanuel stiebler wrote:
> 
> What is the easiest way to figure out, in which blocksizes a tape is written
> ?
> 

  I've had good luck with this:

/*
 * This little program reads a tape and prints out the block sizes.
 * One arg: the raw tape device
 */
#include <stdio.h>
#include <sys/types.h>
#include <sys/file.h>

#define MAXREAD	(512*1024)
char buf[MAXREAD];

main(argc, argv)
	int argc;
	char *argv[];
{
	int fil, bsiz;

	if (argc != 2 || (fil = open(argv[1], O_RDONLY, 0666)) < 0) {
		fprintf(stderr, "Usage: siz /dev/rmt??\n");
		exit();
	}
	while ((bsiz = read(fil, buf, MAXREAD)) > 0)
		printf("%d\n", bsiz);
}

I got it from Rick Macklem.

-- 
David Evans          (NeXTMail/MIME OK)             dfevans@bbcr.uwaterloo.ca
PhD Student, Computer/Synth Junkie         http://bbcr.uwaterloo.ca/~dfevans/
University of Waterloo         "Default is the value selected by the composer
Ontario, Canada           overridden by your command." - Roland TR-707 Manual