#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>


int main( int argc, char *argv[]) {
	int i;
	char *buf;
	int fd;
	clock_t start, stop;

	if (argc < 2) {
		fprintf( stderr, "need filename\n");
		exit(1);
	}
	start = clock();

	buf= (char*) malloc( 12089);
	fd = _open( argv[1], _O_RDWR| _O_CREAT, _S_IWRITE);
	if (fd <= 0) {
		fprintf( stderr, "could not open file\n");
		exit(1);
	}


	for ( i = 0; i < 1000; i++) {
		if (12089 != _write( fd, buf, 12089)) {
			fprintf( stderr, "disk full\n");
			exit(1);
		}
	}
	_close(fd);
	stop = clock();
	printf( "%lf sec\n", (stop -start)*1.0/CLOCKS_PER_SEC);
}