I've got the following function
void remDuplicate(FI NDFILE filey, int sim, char *filePath)
{
char ans;
numFound++;
printf("Found file %s that is %d%% the same as %s. Delete (Y/N)??\n", filePath, sim, filey.filename) ;
scanf("%c", &ans);
ans = tolower(ans);
if (ans == 'y')
{
printf("Removin g file %s\n", filePath);
unlink(filePath );
numRemoved++;
}
printf("Continu ing.\n");
return;
}
which gets called each time two files are found that are dupilcates. Yet scanf only takes input each second time (1st, 3rd, 5th calls etc..) Any thoughts ehy??
void remDuplicate(FI NDFILE filey, int sim, char *filePath)
{
char ans;
numFound++;
printf("Found file %s that is %d%% the same as %s. Delete (Y/N)??\n", filePath, sim, filey.filename) ;
scanf("%c", &ans);
ans = tolower(ans);
if (ans == 'y')
{
printf("Removin g file %s\n", filePath);
unlink(filePath );
numRemoved++;
}
printf("Continu ing.\n");
return;
}
which gets called each time two files are found that are dupilcates. Yet scanf only takes input each second time (1st, 3rd, 5th calls etc..) Any thoughts ehy??
Comment