int file_length(int f);
static int p[4];
char names[]={"jaoe","jack","alice","jill"};
int qcmp(int *a, int *b)
{
 	return strcmp(p[*a],p[*b]);
}
int main()
{
	int f[10000];
	char bf[20];
	int i;
	int start,end;
	
	/* -------------- Part one  */
	qsort(p,4,sizeof(char *),qcmp);
	for (i=0; i<4; i++) printf("Name[%d]=%s\n",i,names[p[i]]);

	/* -------------- Part two  */

	time(&start);
	printf("Enter name"); gets(bf);
	printf("Start\n");
	for (i=0; i<200; i++) {
	 	sprintf(bf,"test%d.tmp",i);
		f[i] = open(bf,O_APPEND | O_BINARY | O_CREAT 
		| O_WRONLY, S_IREAD | S_IWRITE);
		if (f[i]<0) perror("Couldn't open file");
		 write(f[i],bf,2000);
		 close(f[i]); 
	}
	time(&end);
	printf("end %d seconds\n",end-start);
	gets(bf);
	return 0;		
}
