In my main function i have a scanf that should wait for user input, but instead the program just ends, this is the last bit of my main function.
Code:
printf("Would you like to focus on a specific player(y or n): ");
if(scanf("%s",answer)==1) {
if(strcmp(answer,"y")==0|strcmp(answer,"yes")==0) {
printf("Player Slot Number: ");
if((scanf("%d", &slot)==1)&&(slot<=10)&&(slot>=1)) {
printf("Check clicks until(mm:ss): ");
if(scanf("%2d:%2d",&minutes,&seconds)==2) {
c = check_clicks(argv[1],heroes,players,hero_names,minutes,
seconds,slot);
}
else if(scanf("%s",all)==1) {
if(strcmp(all,"all")==0) {
minutes = 99;
seconds = 99;
c = check_clicks(argv[1],heroes,players,hero_names,minutes,
seconds,slot);
}
}
else {
minutes = 2;
seconds = 15;
c = check_clicks(argv[1],heroes,players,hero_names,minutes,
seconds,slot);
}
printf("%d enemy clicks were detected before %02d:%02d replay time\n",c,minutes,seconds);
}
}
}
}
return 0
}
I have a scanf earlier on in the main function and its
Code:
if(scanf("%2d:%2d",&minutes,&seconds)==2) {
c = check_clicks(argv[1],heroes,players,hero_names,minutes,
seconds,0);
}
and that works fine, it waits for user input.
Any help much appreciated.