ftp.nice.ch/pub/next/unix/audio/cmix.s.tar.gz#/cmix/track/restoreplot.c

This is restoreplot.c in view mode; [Download] [Up]

#import <sys/file.h>
#import <stdio.h>




main(argc,argv)
char *argv[];
{
	int in,out,startrestore,endrestore,i,nbytes,nread;
	char *input,*output;
	float buffer[10000];
	
	
	input=argv[1];
	output=argv[2];
	startrestore = atoi(argv[3]);
	endrestore = atoi(argv[4]);
	printf("%d %d\n",startrestore,endrestore);
	if((in=open(input,2)) < 0) {
		printf("cant open inputfile \n");
		exit(-1);
		}
	if((out=open(output,2)) < 0) {
		printf("cant open outputfile\n");
		exit(-1);
		}
	if((lseek(in,startrestore*8,0)) < 0) {
		printf("bad lseek on inputfile\n");
		exit(-1);
		}
	if((lseek(out,startrestore*8,0)) < 0) {
		printf("bad lseek on outputfile");
		exit(-1);
	}
	nbytes = (endrestore - startrestore + 1) * 8;
	printf("nbytestoread = %d\n",nbytes);
	if(nread = read(in,(char *)buffer,nbytes) != nbytes) {
		printf("bad read on inputfile %d\n",nread);
		exit(-1);
		}
	if(nread = write(out,(char *)buffer,nbytes) != nbytes) {
		printf("bad write on outputfile %d\n",nread);
		exit(-1);
		}

}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.