kARTechnology
Sony " VA" "IO"
Hi
completed C subject in my Engineering...
Today I developed a code, I'm getting array is too large and structure is too large.but i need large structures, or is there any alternative way?
the aim is to STORE log records(roll,time) from a fingerprint-based time attendance soft which saves data daywise in plain text format..
and compute the salary per day, if he's late/early going/no outpunch etc
error is in
actual full code of my program[in development...
completed C subject in my Engineering...
Today I developed a code, I'm getting array is too large and structure is too large.but i need large structures, or is there any alternative way?
the aim is to STORE log records(roll,time) from a fingerprint-based time attendance soft which saves data daywise in plain text format..
and compute the salary per day, if he's late/early going/no outpunch etc
error is in
Code:
struct year
{ struct month
{
struct day
{
struct details
{
char name[25];
int hour[40];
int min[40];
int mins[40];
int rec;
int totmins;
int totsal;
char status;
int temp;
}data[100];
}day[31];
}mon[12];
}yr[2];
actual full code of my program[in development...
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include <time.h>
void dummy(float *a)
{
float b=*a; //perform some floating access
dummy (&b); //calling a floating point function
}
main()
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
/*--------- data+details file structure --------*/
struct year
{ struct month
{
struct day
{
struct details
{
char name[25];
int hour[40];
int min[40];
int mins[40];
int rec;
int totmins;
int totsal;
char status;
int temp;
}data[100];
}day[31];
}mon[12];
}yr[2];
/*--------- data file structure --------*/
struct details
{ int empnr;
char name[25];
int salary;
}person[100];
int y1,m1,d1,y2,m2,d2,y,m,d,y3,y4, i=0,noofemp=0,t1,t2,t3;
char fname[20];
clrscr();
printf("Edit \"empdetails.txt\" for adding new or changing roll no, name, salary per day.");
printf("Enter begining date: MM DD YY:");
scanf("%d%d%d",&d1,&m1,&y1);
printf("Enter ending date: MM DD YY:");
scanf("%d%d%d",&d2,&m2,&y2);
if(y1-y2>1)
printf("Cant input greater than years");
printf("Reading Data.");
d=d1;m=m1;y=y1;
//if(y1==y2)
//{y3=0;y4=0;}
//else
//{y3=0;y4=1;}
FILE *emp_file;
FILE *calcemp_file;
emp_file = fopen("emp.txt","r");
calcemp_file = fopen("calcweek.txt","w");
if(emp_file==NULL)
{
printf("\nERROR Accessing source file for computing salary.\n\nPlease use a text document with the following info:\n Roll Name Salary/Day\n\n\n\nFilename of the text document MUST BE \"empdetails\"\ (without the quotes\) ");
getch();
exit(0);
}
/*--------- get data from file --------*/
while(fscanf(emp_file,"%d%s%d", &person[i].empnr, person[i].name,&person[i].salary)==3)
{
i++ ;
noofemp++;
printf(".");
}
fclose(emp_file);
/*--------- get details from file --------*/
for(;y<=y2;y++)
{
for(;m<=m2;m++)
{
for(;d<=d2;d++)
{
sprintf(fname,"%02d-%02d-%02d.dat",d,m,y);
emp_file = fopen(fname,"r");
if(emp_file==NULL)
{ printf("\nERROR Accessing %s for computing salary",fname);
getch();
exit(0);
}
fclose(emp_file);
printf(".");
}
}
}
getch();
}