Ok the code which i have used

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/timeb.h>

int main()
{
struct timeb t1, t2;
unsigned long timeTaken;
FILE * fp;

ftime(&t1);
fp = fopen("abcd.txt","w");
ftime(&t2);
if (fp == NULL)
        printf("fopen() failed, errno = %d\n", errno);
timeTaken = (1000 *(t2.time - t1.time)) + t2.millitm - t1.millitm;
printf("fopen timeTaken %ld\n",timeTaken);
fclose(fp);
ftime(&t1);
unlink("abcd.txt");
ftime(&t2);
timeTaken = (1000 *(t2.time - t1.time)) + t2.millitm - t1.millitm;
printf("unlink timeTaken %ld\n",timeTaken);

return 1;
}


The tests which i have conducted

On Solaris 5.8: 
fopen timeTaken 9
unlink timeTaken 5

On Solaris 5.7:
fopen timeTaken 2
unlink timeTaken 1
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to