A mate is totaly stucj on this and i have no idea...anyone here?
It should be reading in a date in dd/mm/yyyy format, then an amount of cash (its based on a basic bank statement). However it outputs the date with "04" stuck on the end of every year (so we're apparently in the year 200704
i = 0;
while (fgets (line, LINESIZE, ifp) != NULL)
{
strncpy(temp, &line[0], 2);
x = atoi(temp);
t.day = x;
x = 0;
printf("Transaction %i: %d/", i, t.day);
strncpy(temp, &line[3], 2);
x = atoi(temp);
t.month = x;
x = 0;
printf("%d/", t.month);
strncpy(temp2, &line[6], 4);
x = atoi(temp2);
t.year = x;
x = 0;
printf("%d ", t.year);
strncpy(temp2, &line[11], 100);
x = atoi(temp2);
t.transaction_amount = x;
x = 0;
printf("%.2f \n", t.transaction_amount);
i++;
}
It should be reading in a date in dd/mm/yyyy format, then an amount of cash (its based on a basic bank statement). However it outputs the date with "04" stuck on the end of every year (so we're apparently in the year 200704
i = 0;
while (fgets (line, LINESIZE, ifp) != NULL)
{
strncpy(temp, &line[0], 2);
x = atoi(temp);
t.day = x;
x = 0;
printf("Transaction %i: %d/", i, t.day);
strncpy(temp, &line[3], 2);
x = atoi(temp);
t.month = x;
x = 0;
printf("%d/", t.month);
strncpy(temp2, &line[6], 4);
x = atoi(temp2);
t.year = x;
x = 0;
printf("%d ", t.year);
strncpy(temp2, &line[11], 100);
x = atoi(temp2);
t.transaction_amount = x;
x = 0;
printf("%.2f \n", t.transaction_amount);
i++;
}