hi,
I tried here in an another way but the diff.txt consists fo some garbage value please suggest me something
#include<stdio.h>
#include<time.h>
main()
{
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo=localtime(&rawtime);
int hour2;
int minute2;
int seconds2;
int end1[6];
int end=0;
int diff[6];
int start[6];
int i=0;
char ch[6];
char ch1[6];
FILE *fp2;
FILE *fp1;
FILE *fp4;
fp2=fopen("time.txt","r");
while(!feof(fp2))
{
fscanf(fp2,"%c",&ch[i]);
start[i]=ch[i];
i++;
}
fp1=fopen("time2.txt","w");
hour2=timeinfo->tm_hour;
minute2=timeinfo->tm_min;
seconds2=timeinfo->tm_sec;
end=(hour2*3600)+(minute2*60)+seconds2;
fprintf(fp1,"%d",end);
fclose(fp1);
fp1=fopen("time2.txt","r");
while(!feof(fp1))
{
fscanf(fp1,"%c",&ch1[i]);
end1[i]=ch1[i];
i++;
}
//fp4=fopen("diff.txt","w");
for(i=0;i<6;i++)
{
diff[i]=(end1[i]-start[i]);
printf("%d",diff[i]);
i++;
}
//fclose(fp1);
//fclose(fp2);
//fclose(fp4);
}